Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Having .net framework handle .htm and .html files [modified]

Having .net framework handle .htm and .html files [modified]

Scheduled Pinned Locked Moved ASP.NET
asp-netcsharphtmldatabasedotnet
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eggsovereasy
    wrote on last edited by
    #1

    So I tried adding .htm, .html, and even .* to the mapping configuration in IIS to aspnet_isapi.dll and have a httpHandler to handle .htm and .html files like this: <httphandlers> <add type="Project.HttpHandlers.HtmExtensionHandler, Project.HttpHandlers" path="*.htm, *.html" verb="*"> </add> </httphandlers> But when I type in something.html I get a 404 page from IIS (not .net), when I attach the debugger to the asp.net worker process it never goes into the http handler. Is there some reason why IIS won't give these requests to .net? I have also tried with my own made up extensions, but nothing. If I put a blank index.htm file in place and request index.htm then it goes through the handler as expected. I've also tried using an HttpModule to set up an event handler on BeginRequest to rewrite the path, but the HttpModule also never gets called if there is no place holder file.


    Last modified: 16mins after originally posted --

    G 2 Replies Last reply
    0
    • E eggsovereasy

      So I tried adding .htm, .html, and even .* to the mapping configuration in IIS to aspnet_isapi.dll and have a httpHandler to handle .htm and .html files like this: <httphandlers> <add type="Project.HttpHandlers.HtmExtensionHandler, Project.HttpHandlers" path="*.htm, *.html" verb="*"> </add> </httphandlers> But when I type in something.html I get a 404 page from IIS (not .net), when I attach the debugger to the asp.net worker process it never goes into the http handler. Is there some reason why IIS won't give these requests to .net? I have also tried with my own made up extensions, but nothing. If I put a blank index.htm file in place and request index.htm then it goes through the handler as expected. I've also tried using an HttpModule to set up an event handler on BeginRequest to rewrite the path, but the HttpModule also never gets called if there is no place holder file.


      Last modified: 16mins after originally posted --

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Use the "Ignore HTML" option when you are posting markup code in the forum.

      --- single minded; short sighted; long gone;

      1 Reply Last reply
      0
      • E eggsovereasy

        So I tried adding .htm, .html, and even .* to the mapping configuration in IIS to aspnet_isapi.dll and have a httpHandler to handle .htm and .html files like this: <httphandlers> <add type="Project.HttpHandlers.HtmExtensionHandler, Project.HttpHandlers" path="*.htm, *.html" verb="*"> </add> </httphandlers> But when I type in something.html I get a 404 page from IIS (not .net), when I attach the debugger to the asp.net worker process it never goes into the http handler. Is there some reason why IIS won't give these requests to .net? I have also tried with my own made up extensions, but nothing. If I put a blank index.htm file in place and request index.htm then it goes through the handler as expected. I've also tried using an HttpModule to set up an event handler on BeginRequest to rewrite the path, but the HttpModule also never gets called if there is no place holder file.


        Last modified: 16mins after originally posted --

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        That's better. Now I can see what the error is. You can't specify more than one path in the path property. You have to add two keys in the httpHandlers tag, one for "*.htm" and one for "*.html".

        --- single minded; short sighted; long gone;

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups