IIS 7.x: How to use asp.dll to process .htm pages

And

Why does this handler mapping work when the application pool is set to 64 bit mode but fail when 32 bit mode is enabled?

 

by vIISual.net(at)hotmail(dot)com

May 2010

 

 

 

 

 

 

 

 

 

 

With the following web.config, I was able to:

 

1. Browse the default document without a problem

2. Browse classic asp pages without any problem

3. Browse .htm pages and .html pages with asp script in them without any problem

4. Browse to an htm page with jpgs, bmps, gifs and png images in them.

 

try replacing your web.config contents (all contents) with this one:

 

 

 

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

    <system.webServer>

       <handlers>

            <remove name="StaticFile" />

            <add name="StaticFile" path="*" verb="*" modules="DefaultDocumentModule,DirectoryListingModule" resourceType="Directory" requireAccess="Read" />

            <add name="HTML to ASP.dll" path="*.html" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="C:\Windows\System32\inetsrv\asp.dll" resourceType="Unspecified" />

            <add name="HTM to ASP.dll" path="*.htm" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="C:\Windows\System32\inetsrv\asp.dll" resourceType="Unspecified" />

            <add name="Graphics-ICOs" path="*.ico" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />

            <add name="Graphics-PNG" path="*.png" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />

            <add name="Graphics-JPGs" path="*.jpg" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />

            <add name="Graphics-Gifs" path="*.gif" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />

            <add name="Graphics-bmps" path="*.bmp" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />

            <add name="Graphics-jpeg" path="*.jpeg" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />

            <add name="Graphics-tif" path="*.tif" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />

            <add name="Graphics-exif" path="*.exif" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />

            <add name="Graphics-tga" path="*.tga" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />

            <add name="Graphics-wbmp" path="*.wbmp" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />

            <add name="Graphics-wmf" path="*.wmf" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />

            <add name="Graphics-css" path="*.css" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />

        </handlers>

        <defaultDocument>

            <files>

                <add value="default.asp" />

            </files>

        </defaultDocument>

    </system.webServer>

</configuration>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

In the website in focus, go to the features view in the IIS manager.  Focus on the handlers feature.

 

 edited it (removing StaticFileModule) and added a ScriptMap to get asp-laden htm pages to be browsed to as .htm files but processed by asp.dll.

 

 

 

 

 

From the handler mappings feature view, this handler for StaticFile changed from this. . .

 

Description: cid:image002.png@01CAFCFD.40526EB0

 

To this. . .

 

Description: cid:image006.png@01CAFCFD.40526EB0

 

 

For the StaticFile handler, I removed StaticFileModule, as seen below, and left DefaultDocumentModule and Directory ListingModule.

Description: cid:image007.png@01CAFCFD.40526EB0 to Description: cid:image008.png@01CAFCFD.40526EB0

I also changed the mapping from FILE to FOLDER only. 

 Description: cid:image009.png@01CAFCFD.40526EB0 

 

 

I created a regular script map for *, pathed it to asp.dll, mapped it to file only, and gave it script access.

 

Description: cid:image011.png@01CAFCFD.40526EB0 Description: cid:image012.png@01CAFCFD.40526EB0  

Description: cid:image013.png@01CAFCFD.40526EB0   Description: cid:image014.png@01CAFCFD.40526EB0

 

 

As long as the AppPool had Enable 32-bit applications set to False, my asp test.asp page (which had been renamed to test.htm) served fine and was processed by asp.dll.

 

But just as with yours, when I enabled 32 bit applications in the AppPool, I ran into the 404.4 - 0x80070002 error that is partially described here:  

 

942052  Error message when you visit a Web site that is hosted on IIS 7.0: "HTTP Error 404.4 - Not Found"

http://support.microsoft.com/default.aspx?scid=kb;EN-US;942052

 

 

 

The website’s web.config file reads as follows:

 

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

    <system.webServer>

        <handlers>

            <remove name="StaticFile" />

            <add name="StaticFile" path="*" verb="*" modules="DefaultDocumentModule,DirectoryListingModule" resourceType="Directory" requireAccess="Read" />

            <add name="WildASP" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\System32\inetsrv\asp.dll" resourceType="File" preCondition="bitness64" />

        </handlers>

    </system.webServer>

</configuration>

 

 

To solve the problem, I edited the web.config file and removed the following text:   preCondition="bitness64"

 

After removing the highlighted portion, I re-saved the web.config file and restarted IIS.  The htm pages were able to serve again.