【发布时间】:2012-05-20 00:05:34
【问题描述】:
我做错了什么?
我的默认 /User 路由
routes.MapRoute(
"User", // Route name
"{controller}/{action}/{id}", // URL with parameters
new {controller = "User", action = "Index", id = UrlParameter.Optional} // Parameter defaults
);
我想分离代码,所以我创建了另一个控制器“UserProducts”
我的路线
routes.MapRoute(
"UserProducts", // Route name
"user/products/{action}/{id}", // URL with parameters
new { controller = "UserProducts", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
我的 UserProducts 控制器中有 ActionResult 索引,但是我的
localhost/user/products
不起作用:
Error 404 - The resource cannot be found.
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-routing