In short, we did not want routing to try to route requests for static files such as images. Unfortunately, this caused us a headache when we remembered that many ASP.NET functions make requests for .axd files that do not exist on disk.
To fix this, we have included a new extension method in the RouteCollection, IgnoreRoute, which creates a route mapped to the StopRoutingHandler route handler (a class that implements IRouteHandler). Effectively, any request that matches the "ignore route" will be ignored by routing and normal ASP.NET processing will be based on the existing HTTP rendering handler.
Therefore, in our default template, you will notice that we have the following route defined.
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
This handles standard .axd requests.
........
We allow only one route, and this should happen at the end of the URL. However, you can take the following approach. In this example, I added the following two routes.
routes.IgnoreRoute("{*allaspx}", new { allaspx=@ ".*\.aspx(/.*)?"}); routes.IgnoreRoute("{*favicon}", new { favicon=@ "(.*/)?favicon.ico(/.*)?"});
What am I doing here? Eilonβs technique showed me which should display all the URLs of these routes, but then limit which routes to ignore using the Dictionary restrictions. Thus, in this case, these routes will match (and therefore ignore) all requests for favicon.ico (no matter which directory), as well as requests for the .aspx file. Since we talked about routing to ignore these requests, the usual processing of these ASP.NET requests is.