I want to use lowercase URLs in my app and I can see there's a RouteOptions object documented here:
https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.routing.routeoptions?view=aspnetcore-5.0
But how do you actually use RouteOptions?
I thought it would be something similar to the below, but it just generates a compiler warning saying that app.UseRouting() doesn't take any parameters:
app.UseRouting(options => {
options.<no intellisense>
});
So can someone please let me know where I can specify RouteOptions?
You need to configure this in your ConfigureServices method, for example:
services.Configure<RouteOptions>(options =>
{
options.LowercaseUrls = true;
});
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