ASp.NET MVC 1.0 将路由映射到子目录
如何设置 url /customer/export/billing
到控制器 Customer.ExportBilling()
的路由?
当我尝试这样做时:
routes.MapRoute(
"exportCustomerBilling", "customer/export/billing", new { controller = "Customer", action = "ExportBilling" });
我收到 404,控制器方法未被调用。
使用 <%= Html.RouteLink("Exportcustomers for billing", "exportCustomerBilling", null) %>
返回正确的链接,单击它会返回 404。
How to I setup a route of the url /customer/export/billing
to the controller Customer.ExportBilling()
?
When I try this:
routes.MapRoute(
"exportCustomerBilling", "customer/export/billing", new { controller = "Customer", action = "ExportBilling" });
I get a 404, the controller method is not invoked.
Using <%= Html.RouteLink("Export customers for billing", "exportCustomerBilling", null) %>
returns the correct link, clicking on it returns a 404.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能已经在“出口账单”路由上方注册了一条更通用的路由。
将路由调试器之一拖放到您的站点中,并将其注册到 Global.asax 中,这将告诉您:
您通常可以从那里找出需要执行哪些调整。
You've probably got a more general route registered above the Export Billing route.
Drop one of the Routing Debuggers into your site, and register it in the Global.asax, that will tell you:
You can usually work out what tweaking you need to perform from there.