The default ASP.NET MVC 3 project template contains the following IgnoreRoute
directive:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
I have now seen multiple projects change this line (including StackExchange's DataExplorer) to instead something that looks like:
routes.IgnoreRoute("{*allaxd}", new {allaxd = @".*\.axd(/.*)?"});
Could anyone explain in what scenario or in general why the default .axd
route ignoring wouldn't be adequate while this latter version would be? Or the other way around, why might one choose not to use this latter version and instead just stick with the default?
I have to admit I don't fully understand the IgnoreRoute
syntax, and the MSDN documentation on the subject is pretty terse.
There's an explanation in Phil Haack's blog: Make Routing Ignore Requests For A File Extension
The basic idea, quoting Phil, is: