MVC Catch Entire route broken.

My first route:

  //  Should work for /Admin, /Admin/Index, /Admin/listArticles
  routes.MapRoute(
      "Admin",                                              // Route name
      "Admin/{action}",                           // URL with parameters
      new { controller = "Admin", action = "Index" }  // Parameter defaults
  );

      

does not resolve the route (I am using Phil Haack Route Debugger ) and even the last route, the Catch All route does not work

  //Maps any completely invalid routes to ErrorController.NotFound
  routes.MapRoute("Catch All", "{*path}",
      new { controller = "Error", action = "NotFound" }
  );

      

If I go to /Admin/listArticles

, it works, but /Admin

gives me Error 403.15 "The Web server is configured to not list the contents of this directory."

Does this point me to the idea that routing is not being used as it is looking for a physical file in a directory?

This is a simple low level route problem, but I can't get it to work and everyone gives me read links (yes, I know MSDN is there), but no real answers. I researched routes and tried, but I post this because I can't get it to work, any help, answers?

+2


source to share


3 answers


The problem might be that you added this route below the default route, all custom routes should be added by default.



+1


source


The answer to my question was that I had a route called / Admin and I wrote my error log to the / Admin / Error directory. There seems to be no overload to indicate if a route should be resolved or if it is part of a physical directory.



+1


source


Are you using IIS 6.0? If so, you will need to look ...

  //  Should work for /Admin, /Admin/Index, /Admin/listArticles
  routes.MapRoute(
      "Admin",                                              // Route name
      "Admin.mvc/{action}",                           // URL with parameters
      new { controller = "Admin", action = "Index" }  // Parameter defaults
  );

      

Where do you need to install mvc as application extension

0


source







All Articles