Microsoft KB Archive/815172

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

Article ID: 815172

Article Last Modified on 12/3/2007

-

APPLIES TO


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

-



IN THIS TASK

 * SUMMARY
 * Edit Script Mappings in Internet Services Manager
 * Edit the .Config File
 * REFERENCES



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:  Click Start, point to Settings, and then click Control Panel. Double-click Administrative Tools, and then double-click Internet Services Manager. Right-click the virtual server or virtual folder that contains your ASP.NET application, and then click Properties. 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. Under Application Settings, click Configuration. 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. 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.</li> 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: <ol style="list-style-type: lower-alpha;"> Click each application mapping, and then click Edit.</li> In the Executable text box, press CTRL+V to paste the path of your Aspnet_isapi.dll file.</li> In the Verbs section, click to select Limit To, and then type GET, HEAD, POST, DEBUG in the text box.</li> 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.</li></ol> </li></ol>

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: <ol> Open the Web.config file in a text editor (such as Notepad). The Web.config file is located in the application’s root folder.</li> Add the httpHandlers configuration element to the <system.web> section of the application’s Web.config file.</li>  For each file name extension, add the 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=&quot;GET, HEAD, POST, DEBUG&quot; path=&quot;*.htm&quot; type=&quot;System.Web.UI.PageHandlerFactory&quot;/> <add verb=&quot;GET, HEAD, POST, DEBUG&quot; path=&quot;*.html&quot; type=&quot;System.Web.UI.PageHandlerFactory&quot;/> <add verb=&quot;GET, HEAD, POST, DEBUG&quot; path=&quot;*.asp&quot; type=&quot;System.Web.UI.PageHandlerFactory&quot;/> </httpHandlers> </system.web> </li> Save the Web.config file. The ASP.NET application will automatically restart and start handling requests for the specified file name extensions.</li></ol>

back to the top

<div class="references_section">