Tag Archives: iis

Enabling post requests to static (eg, html) pages using IIS 7

Firstly, it seems impossible to do this without installing a backend language to pass the files off to. IIS static file hander does not seem capable of handling post requests. This is silly, but unfortunately, if you’re working with a site with front-end only and need posts requests (for javascript, for example), the default installation of IIS 7 cannot do this.

If you have no backend languages to work with, the easiest thing will be using ASP (as it’s just a case of enabling it on your machine):

  1. Enable ASP and ISAPI modules
    In control panel > programs > turn windows features on or off, expand Internet Information Services > World Wide Web Services > Application Development Features, click on ASP, ISAPI Extensions and ISAPI Filters. Machine will probably tell you to restart.
  2. Delegate Handler Mappings
    In IIS manager, select the machine name from the left, click on Feature Delegation under Management in the middle section of the page. Select Handler Mappings from the list and select Read/Write from the right hand section of the page.
  3. Create new Handler Mapping
    In IIS manager, click on the web site name from the left hand side (probably called Default Web Site with a globe image next to it). Go into Handler Mappings. Add a Module Mapping (link on the right), with the following details:
         Request path: *.html
         Module: IsapiModule
         Executable: %windir%\system32\inetsrv\asp.dll
         Name: html
    In Request Restrictions box for this handler, have the following settings:
         Mapping: unticked
         Verbs: all verbs
         Access: none

You should not need to do the iisreset command – it should just start working now.

 

However, if you’re using PHP (I assume you’ve already install PHP and enabled CGI), do the following:

  1. Delegate Handler Mappings
    In IIS manager, select the machine name from the left, click on Feature Delegation under Management in the middle section of the page. Select Handler Mappings from the list and select Read/Write from the right hand section of the page.
  2. Create new Handler Mapping
    In IIS manager, click on the web site name from the left hand side (probably called Default Web Site with a globe image next to it). Go into Handler Mappings. Add a Module Mapping (link on the right). The details should be the same as with the mapping for the .php extension, but it will be something like this:
         Request path: *.html
         Module: FastCgiModule
         Executable: C:\Program Files (x86)\PHP\php-cgi.exe
         Name: html
    In Request Restrictions box for this handler, have the following settings:
         Mapping: unticked
         Verbs: all verbs
         Access: none