0

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;
        }
    }
Erik
  • 5,355
  • 25
  • 39
  • Can you post your full RouteConfig.cs please? – adaam Jul 20 '14 at 00:27
  • Posted above, but the same thing still happens even if I remove all the routes. – Erik Jul 20 '14 at 00:43
  • I have a feeling that you may need to use `MapPageRoute`, see http://stackoverflow.com/questions/10178276/after-add-mappageroute-to-an-asp-net-mvc-project-the-site-stops-to-enter-in-hom – adaam Jul 20 '14 at 01:04

0 Answers0