How do you enforce lowercase routing in ASP.NET Core?

前端 未结 6 1895
Happy的楠姐
Happy的楠姐 2020-12-04 12:11

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

6条回答
  •  长情又很酷
    2020-12-04 12:15

    For ASP.NET Core:

    Add the following line to the ConfigureServices method of the Startup class.

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

    Thanks to Skorunka for the answer as a comment. I thought it was worth promoting to an actual answer.

提交回复
热议问题