@Html.ActionLink("About", "about", "home")
Code above will generate proper route /home/about. In ASP.NET MVC 4 it is much more easier to achieve this by setting LowercaseUrls property to true in routes initialization. You do this in App_Start/RoutesConfig.cs file. Here is full code snippet:
public static void RegisterRoutes(RouteCollection routes)
{
    routes.LowercaseUrls = true;
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    routes.MapRoute(
        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );
}
This is only available in MVC 4.
No comments:
Post a Comment