AI OnAI Off
Have you tried adding the route first in the route table? By switching line 3 and 4 in your first snippet.
There is another route that captures the request before your one (not a content route added by base.RegisterRoutes). You can however get your route before the other one by doing:
var route = routes.MapRoute( "foo", "foo.pdf", new { controller = "Foo", action = "Index" } ); routes.Remove(route); routes.Insert(0, route);
I'm unable to route a static file to an MVC route when the file exists on disk, although it works fine if the file isn't there.
This is what I've done:
Overriding the RegisterRoutes in Global.asax
Added RouteConfig.cs
Added a handler in system.webServer/handlers
According to Jon Galloway is should work if you add the routes.RouteExistingFiles = true, but I still get an error. Any ideas on how to fix it?