Reputation: 5819
I have the following in my Web.config:
<httpHandlers>
. . .
<add verb="GET,HEAD" path="/" type="Vis.Web.BootHandler, Vis" />
</httpHandlers>
That HTTP handler returns a static HTML page, just to see if it works.
Now when I run my web application (which has no Default.aspx or the likes) I get the default directory listing instead. When I change the path to "/foo"
it works perfectly fine.
I tried ""
for the path, it yields the directory listing as well. Same having it as "/foo"
and then adding a URL mapping to for ""
, "~"
, "~/"
and "/"
How do I handle the web root / override the directory listing with a HTTP handler?
Upvotes: 4
Views: 2280
Reputation: 14888
UPDATED: Regarding comment This can't be done in the development server as it requires a feature of IIS.
ORIGINAL: You need to add a wildcard application mapping to the asp.net DLL so that all requestes (even for directories) are run through the .net runtime and therefore your HTTP Handler.
for more info
Upvotes: 2
Reputation: 1038850
In addition to what @Greg B said you will need to add a dummy default.aspx page and register your handler using /* path:
<httpHandlers>
. . .
<add verb="GET,HEAD" path="/*" type="Vis.Web.BootHandler, Vis" />
</httpHandlers>
Upvotes: 0