Note that there are some explanatory texts on larger screens.

plurals
  1. PO"routes.LowercaseUrls = true;" does not work?
    primarykey
    data
    text
    <p>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..</p> <p><code>@Html.ActionLink("Hello World", "Authorize", "Home")</code> <br /> outputs to <br /> <code>&lt;a href="/Admin/Home/Authorize"&gt;Hello World&lt;/a&gt;</code></p> <p>Area route</p> <pre><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></pre> <p>Default route</p> <pre><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></pre> <h2>Admin Area configs I tried</h2> <pre><code>// admin/Home/Authorize public override void RegisterArea(AreaRegistrationContext context) { context.Routes.LowercaseUrls = true; context.MapRoute( "Admin_default", "{area}/{controller}/{action}/{id}", new { area = "admin", controller = "home", action = "Index", id = UrlParameter.Optional }, new string[] { "ORMebeles.Areas.Admin.Controllers" } ); context.Routes.LowercaseUrls = true; } // admin/Home/Authorize 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[] { "ORMebeles.Areas.Admin.Controllers" } ); context.Routes.LowercaseUrls = true; } </code></pre> <h2>Edit</h2> <p>As it seems this is bug with MVC4 - when you set <code>context.Routes.LowercaseUrls = true;</code> and you have Area/Areas <code>context.Routes.LowercaseUrls = true;</code> won't take any effect, where should we report it or how can we get it fixed?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload