In .net 5 / MVC 6 RC1 we could force lowercase urls in routes with the following:
services.ConfigureRouting(options =>
{
options.LowercaseUrls = true;
});
How is this accomplished in RC2 / .net core 1.0 ?
To ensure that query strings are also lowercase, set the options. LowercaseQueryStrings to true : services. Configure<RouteOptions>(options => { options.
I think that you're now looking for the .AddRouting
extension method instead. You "configure" the instance of the RouteOptions
as part of the addition of the service:
services.AddRouting(options => options.LowercaseUrls = true);
Update
You can also call the following:
services.Configure<RouteOptions>(options => options.LowercaseUrls = true);
I detailed some of the API changes in my blog post here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With