Will the URL /nosuchpage get routed via my ASP.NET MVC application?
Posted
by Gary McGill
on Stack Overflow
See other posts from Stack Overflow
or by Gary McGill
Published on 2010-04-14T10:14:43Z
Indexed on
2010/04/18
6:33 UTC
Read the original article
Hit count: 304
[I'm trying to figure out the reason why I'm having another problem, and this question is part of the puzzle.]
I have an MVC 2 website that has routing set up so that URLs such as /Customer/23/Order/47 get handled by various controllers. I do not have a rule that would match, for example, /nosuchpage and in my Cassini environment a request for that URL will trigger my Application_Error code, which lets me log the error and show a friendly response.
However, when I deployed this website on IIS7 using integrated mode, my Application_Error is not triggered, and IIS shows its own 404 message. No matter what I've tried, I can't get Application_Error to fire.
Now I'm thinking: is the reason it doesn't fire because the request is not getting routed via my application? Either because I didn't explicitly set up a catch-all route, or because the file-extension fools it into thinking it should use the "static file handler" (whatever that is)?
Should I expect my Application_Error to be invoked?
© Stack Overflow or respective owner