and*_*ecu 8 asp.net-mvc asp.net-mvc-routing
请考虑以下路线:
routes.MapRoute(
"Service", // Route name
"service/", // URL with parameters
new {controller = "CustomerService", action = "Index"} // Parameter defaults
);
Run Code Online (Sandbox Code Playgroud)
使用Url.Action("Service", "CustomerService")生成的网址/service而不是预期的网址/service/
有没有办法让这个工作,或者我是否必须求助于实现我自己的路由派生RouteBase?
Legenden - 没有立即解决该问题的方法。您可能已经读过Jason Young关于这个问题的博客文章,其中内容非常丰富。 Scott Hanselmann在这里发表了回复,基本上是说他认为这没什么大不了的,如果是的话,你可以利用新的IIS7重写模块来解决它。
但最终,您可能想查看 murad 在 StackOverflow 上的类似问题上发布的解决方案: TrailinglashonanASP.NETMVCroute