【发布时间】:2010-11-29 12:34:31
【问题描述】:
我的第一条路线:
// 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),甚至最后一条路由,“Catch All”路由也不起作用:
//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 就在那里),但没有真正的答案。我已经研究过路线并尝试过,但我发布这个是因为我无法让它工作,有什么帮助和答案吗?
【问题讨论】:
标签: asp.net-mvc model-view-controller routes try-catch