When you create links in your ASP.NET Core web application with TagHelpers then each word in your URL will start with a capital letter.

Take this for example:

<a asp-controller="About" asp-action="Index">About</a>
<a asp-controller="Tools" asp-action="Index">Tools</a>

This will result in following HTML code where each word from the controller and action name starts with a capital letter in the URL:

<a href="https://driesdeboosere.dev/About">About</a>
<a href="https://driesdeboosere.dev/Tools">Tools</a>

And even in your web browsers address bar the generated URL from the controller and action name starts with a capital letter:

URL in address bar

I would like to have all my URLs in lowercase, like this:

<a href="https://driesdeboosere.dev/about">About</a>
<a href="https://driesdeboosere.dev/tools">Tools</a>

Luckily we can easily set this up in our Startup.cs class in the ConfigureServices method. We just need to setup the route options by adding the AddRouting extension method to services and set the RouteOptions LowercaseUrls property to true.

services.AddRouting(options => options.LowercaseUrls = true);

Be aware that you put this options BEFORE services.AddMvc() or services.AddControllersWithViews()!!

See this example:

public void ConfigureServices(IServiceCollection services)
{
    services.AddRouting(options => options.LowercaseUrls = true);
    services.AddControllersWithViews().AddRazorRuntimeCompilation();
    // other configurations
}

Now all our URLs created by our TagHelpers will be in lowercase.