MVC 的路由问题
Issue in routing for MVC
我想在我的 MVC 应用程序中实现路由。
routes.MapRoute("View",
"View/ViewCustomer/{id}",
new { controller = "Customer", action = "DisplayCustomer",
id = UrlParameter.Optional });
以上代码没有重定向到 CustomerDetail 控制器。
我想用上面的url来调用它。
http://localhost/View/ViewCustomer/
您可以像这样更改代码
routes.MapRoute("View",
"View/ViewCustomer/{id}",
new { controller = "CustomerDetail", action = "DisplayCustomer",
id = UrlParameter.Optional });
应该是controller = "CustomerDetail".
我想在我的 MVC 应用程序中实现路由。
routes.MapRoute("View",
"View/ViewCustomer/{id}",
new { controller = "Customer", action = "DisplayCustomer",
id = UrlParameter.Optional });
以上代码没有重定向到 CustomerDetail 控制器。
我想用上面的url来调用它。 http://localhost/View/ViewCustomer/
您可以像这样更改代码
routes.MapRoute("View",
"View/ViewCustomer/{id}",
new { controller = "CustomerDetail", action = "DisplayCustomer",
id = UrlParameter.Optional });
应该是controller = "CustomerDetail".