In earlier versions of ASP. NET MVC, we can set routes by using the RegisterRoutes method in the app . Lowercaseurls = true; To turn the URL link of the page to lowercase. in ASP. NET Core MVC, the configuration of the route is similar to the following code:
App. USEMVC (configureroutes =>{ configureroutes.maproute ("Default", "{controller=app}/{action=index}/{id}");});
The problem is that the Configureroutes instance type does not contain properties similar to Lowercaseurls, so we cannot configure the URL lowercase feature here.
In ASP. Lowercaseurls's configuration still exists, but it needs to be configured in another place. To implement a routing URL that implements lowercase in an ASP. NET Core project, we just need to add code to the Configureservice method of the Startup class.
Services. addrouting (options = options. Lowercaseurls = True);
This article was released on September 29, 2017 and was tested in the NETCOREAPP2.0 + Aspnetcore 2.0 platform and is running well.
Implementing a lowercase routing url in an ASP. NET Core Project