0
這是爲什麼幫助asp.net路由
<%=Html.ActionLink("Users", "Index", "Users", new { id = "3" })%>
指向這個
http://localhost:1798/Users/Index?Length=8
而是這個
http://localhost:1798/Users/Index/3
註冊途徑方法:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Users", action = "Index", id = "" } // Parameter defaults
);
}
是什麼在你的Global.asax您的RegisterRoutes方法樣子? – BigBlondeViking 2009-09-08 20:48:04