我的第一個航線的航班: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