HOW TO: Migrate an ASP Web Application to ASP.NET While Retaining Existing File Name Extensions (815172)



The information in this article applies to:

  • Microsoft ASP.NET (included with the .NET Framework) 1.0
  • Microsoft Common Language Runtime (included with the .NET Framework) 1.0
  • Microsoft Internet Information Services 5.0
  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual C# .NET (2002)
  • Microsoft Visual C++ .NET (2002)
  • Microsoft ASP.NET (included with the .NET Framework 1.1)
  • Microsoft Common Language Runtime (included with the .NET Framework 1.1)
  • Microsoft Internet Information Services version 6.0
  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C++ .NET (2003)

SUMMARY

This step-by-step article describes how to migrate an ASP Web application to ASP.NET while retaining existing file names.

By default, script mappings are added when you install the .NET Framework on a computer that is running Windows 2000 or Windows Server 2003 if the computer has Internet Information Services (IIS) installed. These script mappings cause pages that have the .aspx file name extension to be run by ASP.NET.

This process allows ASP 3.0 applications to coexist with ASP.NET applications because ASP 3.0 is used to process files that have the .asp file name extension. However, when you upgrade an application from ASP 3.0 to ASP.NET, and the files use the .aspx file name extension after you upgrade, URLs for the ASP 3.0 application are no longer valid. Any favorites, bookmarks, search engine results, or links from other sites that link directly to a page that had an .asp file name extension are no longer valid.

To provide continuity of URLs, you can change application mappings so that any specific file name extension is run as an ASP.NET application, including file name extensions that are associated with ASP 3.0 applications. You must also configure ASP.NET to process files that have nonstandard extensions. This step-by-step article describes the two major tasks of that configuration process.

back to the top

Edit Script Mappings in Internet Services Manager

IIS determines how to handle requests based on the script mapping for the file name extension of the request. You can change these script mappings by using Internet Services Manager. To configure ASP.NET to handle files that have an .asp file name extension, follow these steps:
  1. Click Start, point to Settings, and then click Control Panel.
  2. Double-click Administrative Tools, and then double-click Internet Services Manager.
  3. Right-click the virtual server or virtual folder that contains your ASP.NET application, and then click Properties.
  4. Click the Home Directory tab (or the Directory tab). If an application has not been created for the virtual folder, click Create under Application Settings.
  5. Under Application Settings, click Configuration.
  6. To identify the location of the Aspnet_isapi.dll file that will handle the ASP.NET requests, click the .aspx application mapping, and then click Edit. The Add/Edit Application Extension Mapping dialog box appears.
  7. Select the text in the Executable text box, and then press CTRL+C to copy the text to your clipboard. Click Cancel to return to the Application Configuration dialog box.
  8. For every file name extension that you want ASP.NET to process, replace the current executable path with the Aspnet_isapi.dll path that you identified in step 7. To do this, follow these steps:
    1. Click each application mapping, and then click Edit.
    2. In the Executable text box, press CTRL+V to paste the path of your Aspnet_isapi.dll file.
    3. In the Verbs section, click to select Limit To, and then type GET, HEAD, POST, DEBUG in the text box.
    4. Verify that the Script Engine check box is selected and that the Check If File Exists check box is not selected, and then click OK.
Note When you are replacing an ASP 3.0 application, you may only have to replace the executable path for the .asp file name extension. However, if you are replacing static HTML pages with ASP.NET pages, you might have to replace the executable paths for .htm and .html, also.

back to the top

Edit the .Config File

When you change the application mappings in IIS, IIS sends the request to ASP.NET. You must configure ASP.NET to correctly process files that have the file name extension that you have mapped to it. To add application mappings to ASP.NET, follow these steps:
  1. Open the Web.config file in a text editor (such as Notepad). The Web.config file is located in the application's root folder.
  2. Add the httpHandlers configuration element to the <system.web> section of the application's Web.config file.
  3. For each file name extension, add the <add> subtag. Use a verb attribute of GET, HEAD, POST, DEBUG, a path element that is equal to the file name extension, and a type of System.Web.UI.PageHandlerFactory. The following example shows a section of the Web.config file that configures ASP.NET to handle requests for .htm, .html, and .asp files:
    <system.web>
        <httpHandlers>
    	    <add verb="GET, HEAD, POST, DEBUG" path="*.htm" type="System.Web.UI.PageHandlerFactory"/>
    	    <add verb="GET, HEAD, POST, DEBUG" path="*.html" type="System.Web.UI.PageHandlerFactory"/>
    	    <add verb="GET, HEAD, POST, DEBUG" path="*.asp" type="System.Web.UI.PageHandlerFactory"/>
        </httpHandlers>
    </system.web>
    
  4. Save the Web.config file. The ASP.NET application will automatically restart and start handling requests for the specified file name extensions.
back to the top

REFERENCES

For more information, visit the following Microsoft Web site:back to the top

Modification Type:MajorLast Reviewed:6/13/2003
Keywords:kbConfig kbMigration kbASPObj kbweb kbHOWTOmaster KB815172 kbAudITPRO kbAudDeveloper