I'm having trouble in setting my routes to lowercase by default. For some reason it does not work. I know I can set \[code\]authorize\[/code\] and \[code\]home\[/code\] to lowercase myself, but the \[code\]Admin\[/code\] part (area) will still be capitalized..\[code\]@Html.ActionLink("Hello World", "Authorize", "Home")\[/code\]
outputs to
\[code\]<a href="http://stackoverflow.com/Admin/Home/Authorize">Hello World</a>\[/code\]Area route\[code\]public override void RegisterArea(AreaRegistrationContext context) { context.Routes.LowercaseUrls = true; context.MapRoute( "Admin_default", "Admin/{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }, new string[] { "OR.Areas.Admin.Controllers" } ); context.Routes.LowercaseUrls = true; }\[/code\]Default route\[code\]public static void RegisterRoutes(RouteCollection routes) { routes.LowercaseUrls = true; routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.LowercaseUrls = true; routes.MapRoute( name: "Localization", url: "{lang}/{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, namespaces: new string[] { "OR.Controllers" } ); routes.LowercaseUrls = true; routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, namespaces: new string[] { "OR.Controllers" } ); routes.LowercaseUrls = true; }\[/code\]
outputs to
\[code\]<a href="http://stackoverflow.com/Admin/Home/Authorize">Hello World</a>\[/code\]Area route\[code\]public override void RegisterArea(AreaRegistrationContext context) { context.Routes.LowercaseUrls = true; context.MapRoute( "Admin_default", "Admin/{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }, new string[] { "OR.Areas.Admin.Controllers" } ); context.Routes.LowercaseUrls = true; }\[/code\]Default route\[code\]public static void RegisterRoutes(RouteCollection routes) { routes.LowercaseUrls = true; routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.LowercaseUrls = true; routes.MapRoute( name: "Localization", url: "{lang}/{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, namespaces: new string[] { "OR.Controllers" } ); routes.LowercaseUrls = true; routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }, namespaces: new string[] { "OR.Controllers" } ); routes.LowercaseUrls = true; }\[/code\]