16 September, 2008

Execute ASP in HTML pages

This is a little 'techy' for my typical blog posts, but I had a heck of a time finding an answer online. I recently got a new laptop and needed to reconfigure my ASP development environment. I kept running into one problem, where my home page displayed ASP code at the top (<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%> <% var openMenu; ...), instead of executing.

Turns out you need to add to the basic ASP configuration to execute ASP code that is in HTML pages. Of course that seems like a no-brainer, but I don't recall having done that in the past. Here's the steps to do this:
  1. Go to Administrative Tools in the Control Panel
  2. Launch Internet Information Services (IIS)
  3. Go to your (default) website and open Properties
  4. Go to the Home Directory tab
  5. Click the Configuration.. button under the Application Settings section
  6. On the Mappings tab, click Add
  7. Enter the following information:
    Executable: c:\windows\system32\inetsrv\asp.dll
    Extension: .html
    Verbs | Limit to: GET,HEAD,POST,TRACE
    Check the boxes: Script Engine and Check that file exists
  8. Close the dialog boxes (OK 3 times)
  9. Stop and Start the IIS Server
  10. Test / verify it now works
That's it; very simple, yet so hard if you don't know what you're looking for.

No comments: