If you have ever wanted to convert an existing HTML-based website to an ASP.NET website, but you didn’t like the idea of losing the “page rank” of those pages, I have the solution. Recently, a friend asked for help on this subject, and since we couldn’t find sufficient information online, I am putting the steps to do this in my blog. In this first case, we wanted to use ASP.NET on long-standing pages that had .html and .htm extensions, but this can apply to all other extensions.
Setup ISAPI Application Mapping
The first step is to tell IIS what system you would like the extension to map to.
- Open your existing website in IIS
- Browse to the Home Directory tab
- Open the Application Settings Configuration (you should see a list of existing application mappings)
- Click “Add”
- Browse for the .NET Framework you want to use (e.g.: C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll)
- Enter the extension (such as .htm)
- Limit the mapping to specific verbs (e.g. GET,HEAD,POST,DEBUG)
- Check Script Engine
- Uncheck Check that File Exists
- Click OK and close IIS
Note: If you trouble with a greyed out OK box, check out this KB article: http://support.microsoft.com/?id=317948
Update Web.Config with HttpHandlers and BuildProviders
The last step is to update the Web.config for your website so that ASP.NET knows how you want to manage these new extensions. You will first need to add in a new HttpHandler inside of the System.Web node:
<add verb=”*” path=”*.htm” type=”System.Web.UI.PageHandlerFactory”/>
<add extension=”.htm” type=”System.Web.Compilation.PageBuildProvider”/>
Now save the Web.config file and run your ASP.NET -powered, non-standard-extension page!
For more information on BuildProviders, click here