IIS 7 and IIS 7.5 script map .htm to asp.dll
I recently upgraded a site from a Windows 2003 server to a Windows 2008 R2 Web Server and needed to be able to continue running .htm files through the ASP engine, because many of the pages on the site comingled ASP and HTM.
After spending about 3 hours looking into this, I finally worked out the process (below). I hope this gives some of you a time savings!
- Make sure that ASP is installed on IIS 7 or IIS 7.5 (obviously)
- Setup your web site
- Your ASP files should work normally
- to allow your .htm files to run through the ASP engine, do the following
- On your IIS 7 or IIS 7.5 server, go into the C:\Windows\System32\inetsrv\config directory and edit the file applicationHost.config (you will need to do this in administrator mode, or do it from a different computer networking over to that server, otherwise Windows will protect that file and won’t allow you to change it.)
- Scroll all the way to the bottom and look for the section that corresponds to your web site <location path=”Your Web Site”>
- Change/edit the code block to add in the HANDLERS and HTM map below
<location path="Your Web Site"> <system.webServer> <asp appAllowClientDebug="true" scriptErrorSentToBrowser="true" /> <handlers> <add name="htm" path="*.htm" verb="*" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="File" /> </handlers> </system.webServer> </location>
- Save the file.
- Restart the web server in the IIS Manager by right clicking the server name.
- Test your site. .HTM pages should now work as ASP files by running through the ASP.DLL