我的第一个航线的航班:MVC抓住所有的工作不
// 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
);
不解决途径(我用Phil Haack's Route Debugger),甚至最后的路线,“抓住所有的”路线不工作:
//Maps any completely invalid routes to ErrorController.NotFound
routes.MapRoute("Catch All", "{*path}",
new { controller = "Error", action = "NotFound" }
);
如果我去/Admin/listArticles
它的工作原理,但/Admin
给我Error 403.15 "The Web server is configured to not list the contents of this directory."
指向我的想法,没有路由使用,因为它会在目录中的物理文件?
这是一个简单的低层次的路线问题,但我不能让它工作,大家给我链接,阅读(是的,我知道MSDN就在那里),但没有真正的答案。我已经研究过路线并尝试过,但是我发布了这条路线,因为我无法得到它的工作,任何帮助,答案?
的可能的复制[净MVC路由全部接收不工作(http://stackoverflow.com/questions/318886/net-mvc-routing-catchall-not-working) – jgauffin 2016-05-17 05:49:20