我对 ASP.Net MVC 的 RC1 版本有疑问。每当我在“默认”路由之前添加一个路由时,创建的结果 URL 是为添加的第一个路由。
这是我在 Global.asax.cs 中的路由
routes.MapRoute(
"product-detailed",
"Products/{controller}/{action}/{id}",
new { controller = "ProductSubType", action = "Index", id = "" }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
我的网址创建:
<%= Html.ActionLink("Bikes", "Index", "Bikes") %><br />
<%= Html.RouteLink("Bikes", "product-detailed", new { controller = "Bikes", action = "Index" }) %>
我希望第一个 ActionLink 创建一个像“/Bikes/Index”这样的 Url,第二个 RouteLink 创建一个“/Products/Bikes/Index”,但两个 Url 最终都是“/Products/Bikes/Index”。
我在路由上缺少什么?
谢谢。