I have routes.RouteExistingFiles = true;
in RouteConfig.cs in an ASP.NET MVC 5 application. It won't process an aspx file. If I have try to open a URI like "/api/latest/Default.aspx" I get just some XML with these peculiar messages:
<Error>
<Message>No HTTP resource was found that matches the request URI 'http://localhost:58341/api/latest/Default.aspx'.</Message>
<MessageDetail>No type was found that matches the controller named 'latest'.</MessageDetail>
</Error>
The application has no problem serving up physical files. If I place an html file in the same directory it serves it up just fine. I have tried adding each of the following three lines to my RegisterRoutes:
routes.IgnoreRoute("api");
routes.IgnoreRoute("api/{*pathInfo}");
None of those worked.
It seems to be trying to route my URL to a route which looks like "api/{controller}" which is bizarre, because I don't have any routes which put a controller as the second argument! I've also tried commenting out all my routes - it still gives the same error message and won't process the aspx file.
I need to have RouteExistingFiles = true, because I am using this to provide authorization control for downloading certain files.
It seems like maybe I could add something to <system.webServer><handlers>
to fix this but I don't know what.
Is there anyway I can get this working?
RouteConfig.cs:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("api");
routes.IgnoreRoute("api/*.aspx");
routes.RouteExistingFiles = true;
}
}