Neither HttpHandler nor HttpApplication is getting called for /

215 views Asked by At

I have an IHttpHandler registered like this:

    <httpHandlers>
        <add verb="*" path="*" type="MindTouch.Dream.Http.HttpHandler, mindtouch.core"/>
    </httpHandlers>

Which catches /foo, /foo/bar, etc. just fine, but on / the Visual Studio built-in server does not hit hit either the HttpApplication or my handler.

2

There are 2 answers

0
ulty4life On BEST ANSWER

That's the way to do it. Your web server/site will have a setting which specifies the default document to serve for a directory. If not present or not set, the web server will attempt to serve either the directory listing which should be turned off for security, a security error if the listing is not available, or nothing.

So in your case prior to the default document existing, "/" was not actually making an application request.

0
Arne Claassen On

I fixed it and I think I recall this being an ancient ASP.NET issue:

I created a file called Default.htm, which ASP.NET will try to resolve the / path to and since there is now a real path to resolve to, the HttpApplication gets called, incidentally with a path of /default.htm.

Is there a less hacky solution to this? Gladly would accept a different answer than my own :)