Nov*_*ato 2 asp.net-mvc asp.net-mvc-routing
我究竟做错了什么?
我的默认/用户路线
routes.MapRoute(
"User", // Route name
"{controller}/{action}/{id}", // URL with parameters
new {controller = "User", action = "Index", id = UrlParameter.Optional} // Parameter defaults
);
Run Code Online (Sandbox Code Playgroud)
我想分开代码,所以我创建了另一个控制器"UserProducts"
我的路线
routes.MapRoute(
"UserProducts", // Route name
"user/products/{action}/{id}", // URL with parameters
new { controller = "UserProducts", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
Run Code Online (Sandbox Code Playgroud)
我的UserProducts控制器中有ActionResult索引,但是我的
localhost/user/products
Run Code Online (Sandbox Code Playgroud)
不起作用:
Error 404 - The resource cannot be found.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
79 次 |
| 最近记录: |