Tuesday, April 5, 2011

ASP to ASP.NET Migration

Migrating your web based application from ASP to ASP.NET can open the door of a whole new world of possibilities. ASP.NET is a technology used to create dynamic web application. Migration to ASP.NET can be as simple as running your code through a wizard or just changing the file extension from .asp to .aspx or may be a complete rewrite and rearchitecturing of the application.

It’s not only about upgrading to latest framework and being in sync with world but you also need this to respect frequently changing business demands or technology challenges either to improve operational efficiency or to manage risk. There are lots of advantages of porting your application to ASP.NET over Classic ASP.

ASP to ASP.net Application Migration: Key Features

• It allows code compilation instead of code interpretation, and provides CLR for built in garbage collection to avoid memory leaks.

• Compiled execution - Makes the ASP.NET applications much faster than ASP and the output caching feature eliminate the need to query the database each time the request is made.

• Code behind feature in ASP.NET applications separates the design page with the code page.

• Better Language Support - The .NET platforms supports around 25 .NET compatible languages as compared to ASP, which can support only two scripting languages -- VBScript and JavaScript. Support of more than 4500 .Net framework classes.

• Event-Driven Programming - In-built server controls and event handling helps developers to easily create applications.

• Improved Scalability

• Improved Performance - ASP.NET applications can handle two to three times the request per second as compared to ASP applications

• Easier Configuration and Deployment

• Easier Code Maintenance – Separate layered structure makes code maintenance much easier as compared to ASP, where a single file is used to write HTML, VB script, Java script, and ASP code.

• With an ASP application entire web server may go down if one application crashes but ASP.NET processes run in a different server space and in separate application domain. This saves entire web server to crash just because of one application.


As I said earlier, migrating ASP to .NET framework may look like just changing the file extensions from .ASP to .ASPX, but in reality there are various levels of porting that may be applied to the system. In one scenario, one application may require the implementation of some very basic porting mechanisms and syntactical changes, but another application may demand to have some rich features of ASP.NET and VB.NET such as ASP .NET web controls, Microsoft ADO .NET, the Microsoft .NET framework classes etc. then you may need to develop the new system.

Changes in code

Following are the major areas one will have to take care of, while migrating from ASP to ASP.NET

Core API Changes: These changes refer to the changes made to the API method calls while migration.

Structural Changes: These changes refer to the changes that affect the layout and coding style of an application. For example ASP.NET pages only support one language on a single page where as ASP allowed multiple languages to be used on a single page. ASP.NET page functions must be declared in script runat=server blocks where as in ASP, page functions are declared within <% %> blocks.

Visual Basic Language Changes: VB.NET is a complete programming language as compared to VB Script that was used in ASP.

COM-Related Changes: VB.NET code migration does not force you to incorporate any COM-related changes in your code. Most of these changes are back stage changes and are done automatically. Some changes include the change in threading model, early binding and late binding changes and changes in OnStartPage & OnEndPage methods in the code.

Application Configuration Changes: ASP.NET requires you to store all your configuration settings in Web.config file, which is available in the main application directory.

State Management Issues: ASP.NET does not require you to change your Session or Application objects. On the other hand it provides State Management Options for Inproc, StateServer, SqlServer for improved control on your applications.

Security-Related Changes: ASP.NET supports Windows, Passport, and Forms-based authentication, including cookie management and automatic redirecting of unauthorized logins. Out of these authentication methods, Passport based authentication in a new feature added to ASP.NET. Unlike ASP, ASP.NET does not do per-request impersonation. It does not allow your code to run on behalf of authenticated user.

Data Access: ASP.NET uses ADO .NET, which offers an enormous range of features as compared to ADO to improve your data access methods. Though you need not make any code changes for migration but you can make use of all ADO.NET features in your code.

This migration can happen in two ways:

Vertical Migration – This refers to migrating an application one tier at a time. Vertical migration approach would proceed through all the pages of the one (e.g. user interface) tier for each module, followed by the other (e.g. business and data) tiers. Most appropriate when the application's modules are tightly coupled and minimal changes are required to the interfaces between application tiers.

Horizontal Migration – This refers to migration of an application module by module, completing the migration for all three tiers of one module before moving on to the next. A horizontal migration is most appropriate when application modules are loosely coupled and when interfacing between different application tiers is a tedious task.

Stages of Migration

You may find some tools claiming complete migration, but I recommend not relying completely on tools. Tools can be good for basic migration but advanced migration requirements of the code can only be fulfilled using manual intervention in code.

Following are the main stages of migration life cycle

Analysis: Here you analyze the existing code, and accordingly plan a migration strategy. You should consider the scope of migration, the processes required for migration such as code modification and testing plans. Here you should also identify the .NET specific functionality that can be added to the application or can be replaced with ASP.NET functionality.

Conversion: Here you do the actual code conversion. Start developing and modifying modules for migration. Ensure proper unit testing and peer reviews for the converted code.

Re-factoring: Here you perform code optimization and design improvement. This stage can actually enable you to get long terms gains from the migration and can be helpful in drastically improving the performance of the application.

Testing: Lastly you should conduct functional and non-functional testing for the modules that have been successfully migrated.
Thus, ASP to ASP.NET migration means complete object-oriented programming structure, easy maintenance, reusable code, automatic documentation from reverse engineering, ASP.NET controls, and multiple-language debugger.

No comments:

Post a Comment