Thursday, October 20, 2005

Migrating to ASP.NET 2.0 -- Its backward compatible

Here are my investigations based on MSDN and a running site at Microsoft since Aug 2005 with better performance than before:

· Because of the way that the .NET Framework is designed, you can deploy the 2.0 framework without disrupting a current installation of the 1.0 or 1.1 frameworks.

To configure a 1.x application's script map to use the .NET Framework version 2.0

  • On the Start menu, click Run.
  • In the Open box, type inetmgr and click OK.
  • In Internet Information Services (IIS) Manager, expand the local computer, and then expand Web Sites.
  • Select the target Web site that is running in the .NET Framework version 1.x.
  • Right-click the name of the virtual directory for the Web site, and then click Properties.
    The Properties dialog box appears.
  • In the ASP.NET version selection list, choose the .NET Framework version 2.0.
    Click OK.

  • Navigate to a page in your application and confirm that your application runs as expected.

· If you are planning on using ASP.NET 2.0 on a production site, you will need to acquire the Microsoft Visual Studio 2005 Beta 2 Go-Live license (Nov 2005 is the final release of VS .NET 2005, so this may change) http://lab.msdn.microsoft.com/ or http://msdn2.microsoft.com/ . Basically, Microsoft does not offer support for the pre-release products.
· ASP.NET 2.0 and ASP.NET 1.1 Applications can live on the same IIS Server: By default, your 1.x applications will continue to use the 1.x framework. However, you will have to configure your converted/new applications (web sites/virtual directories) to use the 2.0 framework.
· Requirements for hosting ASP.NET 2.0 Apps:
o Internet Information Services (IIS) version 5.0 or later. To access the features of ASP.NET, IIS with the latest security updates must be installed prior to installing the .NET Framework. (So you can run ASP.NET 2.0 apps on old boxes with IIS5-Win 2000 Server)
o ASP.NET is supported only on the following platforms: Microsoft Windows 2000 Professional (Service Pack 3 recommended), Microsoft Windows 2000 Server (Service Pack 3 recommended), Microsoft Windows XP Professional, and Microsoft Windows Server 2003 family.
o Microsoft Data Access Components 2.8; is recommended. This is for applications that use data access.
o Supported Operating Systems: Windows 2000; Windows 98; Windows 98 Second Edition; Windows ME; Windows Server 2003; Windows XP. Make sure you have the latest service pack and critical updates for the version of Windows that you are running. To find recent security updates, visit Windows Update.
o You must also be running Microsoft Internet Explorer 5.01 or later for all installations of the .NET Framework. Install Internet Explorer 6.0 Service Pack 1.

Here's what we gain:
New Features in ASP.NET 2.0
· Master pages are a new feature introduced in ASP.NET 2.0 to help you reduce development time for Web applications by defining a single location to maintain a consistent look and feel in a site. Master pages allow you to design a template that can be used to generate a common layout for many pages in the application.
· Content pages (I call them business logic sub-pages) are attached to a master-page and define content for any ContentPlaceHolder controls in the master page. The content page contains controls that reference the controls in the master page through the ContentPlaceHolder ID. The content pages and the master page combine to form a single response.
· Nested Master Pages: In certain instances, master pages must be nested to achieve increased control over site layout and style. For example, your company may have a Web site that has a constant header and footer for every page, but your accounting department has a slightly different template than your IT department.
· Overriding Master Pages: Although the goal of master pages is to create a constant look and feel for all of the pages in your application, there may be situations when you need to override certain content on a specific page. To override content in a content page, you can simply use a content control.
· Themes and Skins: ASP.NET 2.0 rectifies the issue of using CSS and inline styles in ASP.NET 1.1 pages, through the use of themes and skins, which are applied uniformly across every page and control in a Web site.A skin is a set of properties and templates that can be used to standardize the size, font, and other characteristics of controls on a page. Themes are similar to CSS style sheets in that both themes and style sheets define a set of common attributes that apply to any page where the theme or style sheet is applied.
· Security: Managing User Info with Profiles and Login Controls: The membership provider and login controls in ASP.NET 2.0 provide a unified way of managing user information. ASP.NET 2.0 offers new login controls to help create and manage user accounts without writing any code.The ASP.NET 2.0 profile features allow you to define, save, and retrieve information associated with any user that visits your Web site. In a traditional ASP application, you would have to develop your own code to gather the data about the user, store it in session during the user's session, and save it to some persistent data store when the user leaves the Web site.
· Localizaton. Enabling globalization and localization in Web sites today is difficult, requiring large amounts of custom code and resources. ASP.NET 2.0 and Visual Studio 2005 provide tools and infrastructure to easily build Localizable site including the ability to auto-detect incoming locale's and display the appropriate locale based UI. Visual Studio 2005 includes built-in tools to dynamically generate resource files and localization references. Together, building localized applications becomes a simple and integrated part of the development experience.
· 64-Bit Support. ASP.NET 2.0 is now 64-bit enabled, meaning it can take advantage of the full memory address space of new 64-bit processors and servers. Developers can simply copy existing 32-bit ASP.NET applications onto a 64-bit ASP.NET 2.0 server and have them automatically be JIT compiled and executed as native 64-bit applications (no source code changes or manual re-compile are required).
· Caching Improvements. ASP.NET 2.0 also now includes automatic database server cache invalidation. This powerful and easy-to-use feature allows developers to aggressively output cache database-driven page and partial page content within a site and have ASP.NET automatically invalidate these cache entries and refresh the content whenever the back-end database changes. Developers can now safely cache time-critical content for long periods without worrying about serving visitors stale data.
· Web Parts: Web Parts are modular components that can be included and arranged by the user to create a productive interface that is not cluttered with unnecessary details. The user can:
o Choose which parts to display.
o Configure the parts in any order or arrangement.
o Save the view from one Web session to the next.
o Customize the look of certain Web Parts.
· Better Development Environment: ASP.NET 2.0 continues in the footsteps of ASP.NET 1.x by providing a scalable, extensible, and configurable framework for Web application development. The core architecture of ASP.NET has changed to support a greater variety of options for compilation and deployment. As a developer, you will also notice that many of your primary tasks have been made easier by new controls, new wizards, and new features in Visual Studio 2005. Finally, ASP.NET 2.0 expands the palette of options even further by introducing revolutionary new controls for personalization, themes and skins, and master pages. All of these enhancements build on the ASP.NET 1.1 framework to provide an even better set of options for Web development within the .NET Framework.
· Last but not the least there's a host of new language features that reduce code lines in .NET 2.0: What's New in the C# 2.0 Language and Compiler
With the release of Visual Studio 2005, the C# language has been updated to version 2.0, which supports the following new features:
o Generics
Generic types are added to the language to enable programmers to achieve a high level of code reuse and enhanced performance for collection classes. Generic types can differ only by arity. Parameters can also be forced to be specific types. For more information, see Generic Type Parameters.

o Iterators
Iterators make it easier to dictate how a foreach loop will iterate over a collection's contents.

o Partial Classes
Partial type definitions allow a single type, such as a class, to be split into multiple files. The Visual Studio designer uses this feature to separate its generated code from user code.

o Nullable Types
Nullable types allow a variable to contain a value that is undefined. Nullable types are useful when working with databases and other data structures that may contain elements that contain no specific values.

o Anonymous Methods
It is now possible to pass a block of code as a parameter. Anywhere a delegate is expected, a code block can be used instead: there is no need to define a new method.

o Namespace alias qualifier
The namespace alias qualifier (::) provides more control over accessing namespace members. The global :: alias allows access the root namespace that may be hidden by an entity in your code.

o Static Classes
Static classes are a safe and convenient way of declaring a class containing static methods that cannot be instantiated. In C# version 1.2 you would have defined the class constructor as private to prevent the class being instantiated.

o External Assembly Alias
Reference different versions of the same component, contained in the same assembly, with this expanded use of the extern keyword.

o Property Accessor Accessibility
It is now possible to define different levels of accessibility for the get and set accessors on properties.

o Covariance and Contravariance in Delegates
The method passed to a delegate may now have greater flexibility in its return type and parameters.

o How to: Declare, Instantiate, and Use a Delegate
Method group conversion provides a simplified syntax for declaring delegates.

o Fixed Size Buffers
In an unsafe code block, it is now possible to declare fixed-size structures with embedded arrays.

o Friend Assemblies
Assemblies can provide access to non-public types to other assemblies.

o Inline warning control
The #pragma warning directive may be used to disable and enable certain compiler warnings.

o volatile
The volatile keyword can now be applied to IntPtr and UIntPtr.

Thanks to the various links by Microsoft for the above info.
http://msdn2.microsoft.com/en-us/library/ms228038.aspx

http://msdn2.microsoft.com/en-us/library/ms228211.aspx
http://msdn2.microsoft.com/en-us/library/ms228097.aspx
http://msdn2.microsoft.com/en-us/library/7cz8t42e.aspx