In ASP.NET 4 this was as easy as routes.LowercaseUrls = true;
in the RegisterRoutes
handler for the app.
I cannot find an equivalent in ASP
As other answers indicate, adding:
services.Configure(options => options.LowercaseUrls = true);
before
services.AddMvc(...)
works great, but I also want to add that if you use Identity, you will also need:
services.AddIdentity(options =>
{
var appCookie = options.Cookies.ApplicationCookie;
appCookie.LoginPath = appCookie.LoginPath.ToString().ToLowerInvariant();
appCookie.LogoutPath = appCookie.LogoutPath.ToString().ToLowerInvariant();
appCookie.ReturnUrlParameter = appCookie.ReturnUrlParameter.ToString().ToLowerInvariant();
});
And obviously, replace both IdentityUser
, and IdentityRole
with your own classes if required.
I just tested this with .NET Core SDK 1.0.4 and the 1.0.5 runtime.