Question

I'm writing a custom HttpHandler to process web requests for a web framework I'm writing but trying to find a way to programatically "ignore" the request if no url route is matched. What I mean by ignore is if no predefined route matches the incoming request url to then default to the standard request processing you would get if you were using a raw ASP.Net web application.

The only way I can find that actually works so far is to remove the custom http handler for a specific path, e.g.:

<location path="Test">
    <system.webServer>
        <handlers>
            <remove name="DefaultHandler"/>
        </handlers>
    </system.webServer>
</location> 

I'm not massively satisfyed with this solution and would like to implement something akin to MVC's IgnoreRoute("..."). Digging through ths source though is a bit of a thankless task and I can't see where it's actually doing it.

So ideally I'd like to know if it's possible to somehow exit the custom http handler and let the application handle it in a default manner or find out how MVC does this.

Anyone have any ideas?

Thanks.

Was it helpful?

Solution

I don't think you can do it in an Httphandler.

Consider using an HttpModule. This is also how MCV routing works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top