Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Thursday, August 24, 2006

Converting ASP to ASP.NET by Microsoft


  • Running ASP and Microsoft ASP.NET on the same Web server
  • Examining a common ASP application
  • Porting the ASP application to ASP.NET


The following should be true for you to get the most out of this document:

  • You are familiar with Microsoft® Visual Basic® programming concepts and terms
  • You are familiar with ASP


Running ASP and ASP.NET on the Same Web Server
Examining a Sample ASP Application
Porting the ASP Application to ASP.NET

Running ASP and ASP.NET on the Same Web Server

One of the first things you are likely to notice when working with ASP.NET is the new file extension: ASP.NET pages use .aspx, as opposed to the .asp extension used with ASP. Additionally, when an ASP.NET page is requested, IIS hands off the request to the aspnet_wp.exe process; ASP uses asp.dll.

ASP and ASP.NET can both be used on the same Web server. That is, a Web site or Web application within a site can contain both ASP.NET pages and ASP pages. Because both ASP and ASP.NET pages can be accessed from the same Web server, you are not required to port your existing ASP pages over to ASP.NET-compatible pages. However, there are many advantages to porting your application from ASP to ASP.NET. Some of the biggest advantages include:

  • Increased performance: Microsoft tests have shown that ASP.NET applications can handle two to three times the requests per second as classic ASP applications.
  • Increased stability: Processes are closely monitored and managed by the ASP.NET run time, so that if one misbehaves (leaks, deadlocks), a new process can be created in its place, which helps keep your application constantly available to handle requests.
  • Increased developer productivity: New features like server controls and event handling in ASP.NET help developers build applications more rapidly and in fewer lines of code. It is also easier than ever to separate code from HTML content.

Unfortunately, porting existing ASP pages to ASP.NET pages is almost never as easy as simply renaming the file extension from .asp to .aspx because, among other factors, there are significant differences between Microsoft Visual Basic Scripting Edition (VBScript) and Visual Basic .NET. The good news is that most of the needed changes are syntactical and automatic. Visual Basic .NET code that uses COM components (such as ADO or custom COM components you may have written) can virtually be left as is; C# code, however, requires a bit of extra code to work with COM components, which is beyond the scope of this document.

This document, which is divided into two sections, begins with an examination of a typical data-driven ASP application. In the later section, you'll look at porting this ASP application to ASP.NET.

Note   This document focuses on porting an ASP application to ASP.NET with as few changes to the original ASP code as possible; it does not examine rebuilding an ASP application from the ground up, using features new to ASP.NET.

Examining a Sample ASP Application

The sample ASP application that you will be porting to ASP.NET is a Project Report Application for a fictional company. The application is written in VBScript. This typical application displays information about ongoing and past projects, allowing the user to specify certain requirements on the Project Report display.

This ASP application is data-driven, as the project information is stored in a database; specifically, two database tables are used: Project and Department. The Department table contains information about each department in the company and the Project table contains information about each project, such as: project name, start date, estimated completion date, actual completion date, priority, the department in charge of the project (via a foreign key to the Department table), and a thorough project description.

A user browsing to the Project Information Web page is shown a listing of projects that were started in the past year. Two list boxes allow the user to customize the view of the current projects. The first list box lets the user specify to view ongoing, completed, or all projects. (An ongoing project is one whose completion date is NULL, and a completed project has an actual and past completion date.) The second list box permits the user to further customize the report by viewing projects by a particular department.

Figure 1 shows the project report user interface. In this instance, the user has opted to view all ongoing projects for the Internal Computer Services department.

Continue it From Microsoft

Post a Comment