开发者

Neither HttpHandler nor HttpApplication is getting called for /

开发者 https://www.devze.com 2023-01-19 12:22 出处:网络
I have an IHttpHandler registered like this: <httpHandlers> <add verb=\"*\" path=\"*\" type=\"MindTouch.Dream.Http.HttpHandler, mindtouch.core\"/>

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开发者_JAVA百科 server does not hit hit either the HttpApplication or my handler.


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.


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 :)

0

精彩评论

暂无评论...
验证码 换一张
取 消