search
AI OnAI Off
A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
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);
Thanks Johan, I got an answer back from Epi support who said there's a bug but suggested that workaround. It works, although it messed up a few other routes so had to fix those as well.
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?