locked
Execute ASP code in *.html files RRS feed

  • Question

  • User-240988154 posted

    Hi All,

    I'm currently migrating a legacy web site from 2k3/iis6 to 2k12/iis8.5. There is some server side code written in Classic ASP (JScript) which needs to be executable via html extension files. I've tried adding Handler Mappings, tweaking MIME Types and updating applicationHost files directly but still no luck.

    I'm probably missing something trivial, so any help would be greatly appreciated.

    These are the steps which I have taken:

    Installed IIS with following roles:

    • ASP
    • ISAPI extensions
    • ISAPI filters
    • SSI

    Setup a new website with following configuration:

    • Script Language: JScript
    • Enable Parent Paths: True

    Application Pool:

    • Enable 32bit Apps: True
    • Managed Pipeline Mode: Integrated

    Handler Mappings:

    Added the below highlighted mapping to match the existing Classic ASP mapping. This is how it looks in the applicationHost file:

    <add name="ASP as HTML" path="*.html" verb="GET, POST, HEAD" type="" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="File" requireAccess="Script" allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />

    <add name="ASPClassic" path="*.asp" verb="GET,HEAD,POST" type="" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="File" requireAccess="Script" allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />

    MIME Types

    Removed MIME Type for .html - Just in case this was confusing IIS.

    Added a new local MIME type for .html, using 'application/asp'

    No joy unfortunately, anything in code tags just gets rendered on the page. I've tested with a simple test.asp page and that executes the script successfully.

    Any help would be greatly appreciated as I'm struggling with next steps.

    Cheers,

    Matt

    Tuesday, November 3, 2015 12:55 PM

Answers

  • User1183424175 posted

    Hi,

    I only add module maping for html wich works for me on IIS 8.5 and win 8.1:

    <handlers>
                <remove name="ASPClassic" />
                <add name="take html as classic asp" path="*.html" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="C:\Windows\System32\inetsrv\asp.dll" resourceType="File" preCondition="" />
                <add name="ASPClassic" path="*.asp" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="File" requireAccess="Script" />
            </handlers>

    And please test if the simple page(test.html) works for you:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
      <title>BotDetect CAPTCHA ASP Form Sample</title>
    </head>
    <body>
      <form method="post" action="ProcessForm.asp" id="form1">
    
        <h1>BotDetect CAPTCHA ASP Form Sample</h1>
    <%
     response.write("My first ASP script!")
     %>
    <p><%Response.Write(now())%></p> 
    		<h2>Add Message
    	This page was last refreshed on <%= now() %>, <br>
      </form>
    </body>


     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, November 4, 2015 12:53 AM