In IIS, Is it possible to execute a .HTML page as aspx?

6,804

Yes, it's possible. The link you provided is correct, although like you say it's for asp.dll instead of aspnet_isapi.dll.

The way to do it in IIS6 is:

  • Edit the properties of the website
  • Select the Home Directory tab
  • Click the Configuration button
  • Edit your .aspx entry and copy the path into your clipboard
  • Create a new extension for .html (and .htm if you want) and paste what you have in the clipboard.

You'll also need to tell ASP.NET what to do with .html pages. To do this, in your web.config file, add a new entry to your httpHandlers section, like so:

<httpHandlers>
   <add path="*.html" verb="*" type="System.Web.UI.PageHandlerFactory" />
</httpHandlers>

In IIS7, if you are running your app pool in Classic mode then go to the website and the Handler Mappings section.
Take note of the entries for Path=.aspx.
Copy them and make them as .html.

Then do the same step to your web.config that I mentioned above.

If you're using integrated mode in IIS7, then you only need to do the web.config addition.

Share:
6,804

Related videos on Youtube

Quandary
Author by

Quandary

Mind the gap.

Updated on September 18, 2022

Comments

  • Quandary
    Quandary over 1 year

    Question:

    We have a 3rd party portal that makes a copy of a html/aspx page, and puts it into a temporary folder, CHANGING THE EXTENSION to .HTML in all cases (also it the root page was .aspx).

    Unfortunately, that means it does not execute the ASP.NET inline scripts...

    So my question:
    Is it possible to get IIS 6 & 7 to interprete (and then execute) a HTML page as aspx page ?
    (It's not possible to change the 3rd party portal)

    Should be possible.

    I only found this one:
    http://forums.digitalpoint.com/showthread.php?t=270061

    but it's only talking about asp, and not asp.net.

  • Quandary
    Quandary almost 13 years
    Finally, a reason to like IIS7. Thank you very much.