21 June, 2010

Mapping HTML files to run Classic ASP on IIS7

I found that IIS 7 on Windows 2008 Server to be much different from prior versions of IIS. The first hurdle was to realize that Classic ASP isn't installed by default. In searching board posts to solve my issue, I found countless posts with directions to install Classic ASP.

So getting this far, I was unable to process my HTML files that had embedded Classic ASP code, In prior versions of IIS, you could just add *.html to the previous defined *.asp listing. With IIS 7 though, this created problems with the .asp pages, and did not solve the issue either. The trick is to make a new entry in the HandlerMappings specifically for *.html.
  • Request path: *.html
  • Executable: %windir%\system32\inetsrv\asp.dll
  • Name: anything meaningful to you
  • Mapping: File
  • Verbs: GET,HEAD,POST
  • Access: Script
Once you've completed this...
  • Go to %windir%\system32\inetsrv\config\applicationHost.config file
  • Find the new entry (search on the name you set in the HandlerMapping)
  • Remove the preCondition portion of the line
  • Restart the webserver
For me, this solved the problem.

Here's a bonus tip for configuring IIS 7.
When I went to my hostname (URL) without a file, it didn't display my Default Document (index.html). I had to change the StaticFile Mapping from "File" to "File or folder" to get it to work.

No comments: