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!
  1. Make sure that ASP is installed on IIS 7 or IIS 7.5 (obviously)
  2. Setup your web site
  3. Your ASP files should work normally
  4. to allow your .htm files to run through the ASP engine, do the following
  5. 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.)
  6. Scroll all the way to the bottom and look for the section that corresponds to your web site <location path=”Your Web Site”>
  7. Change/edit the code block to add in the HANDLERS and HTM map below
  8. <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>
  9. Save the file.
  10. Restart the web server in the IIS Manager by right clicking the server name.
  11. Test your site. .HTM pages should now work as ASP files by running through the ASP.DLL

2 comments

  • David

    Just a quick note that this can also be done via the IIS UI on the handler mappings pages (For either the whole server or individual sites)

  • Brian

    David (august 5th),

    That *should* have worked, but for some reason it didn’t.

    This solution is the only one that worked for me. Since I spent about an hour, it saved me 2. Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *