How can I change the ActionLink behavior?
Been new to MVC 2, how can we get a link as:
http://localhost:13269/Terms
instead
http://localhost:13269/Frontend/Terms
as this is the result of:
<%: Html.ActionLink("Terms & Conditions", "Terms", "Frontpage")%>
even if I don't specify the Controller
like <%: Html.ActionLink("Terms & Conditions", "Terms")%>
as I changed the route to
r开发者_运维技巧outes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Frontend", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
Try this as a new route definition (declare this before the default route)
routes.MapRoute(
"DefaultFontEnd", // Route name
"{action}/{id}", // URL with parameters
new { controller = "Frontend", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
精彩评论