About this Article

We aware of that our Asp .Net MVC application generate mixed-case URLs like https://dotnet-helpers.com/Home/About or https://dotnet-helpers.com/home/about. So if we type URLs then it wont consider the upper case or lower case. In ASP.NET MVC, route generates outgoing URLs based on the casing of our controller and action names. By default, ASP.NET MVC controllers are classes and actions are methods,so these outgoing URLs are likely be camel-case.

Having Two URLs make problem in Search Rankings:

In ASP.NET MVC, the URLs generated by the routing mechanism are based on the controller and action names. Technically be considered , this will lead to duplicate pages with the same content. Most SEOs will recommend sticking to have only one version.

Solution :

LowercaseUrls property on the RouteCollection class has introduced in ASP .NET 4.5. Using this property we can lowercase all of our URLs.

Eg : routes.LowercaseUrls = true;

Example :

RouteConfig.cs

Include below pieace of code in the RouteConfig.cs file to convert all the URLs in to lowercase.

routes.LowercaseUrls = true;

Controller:

A simple controller which has two action method namely LowerCaseUrls and LoadUserDetails.

LowerCaseUrls.cshtml :

Output:

LowerCaseUrls in MVC Output1 -Dotnet-helpers

After clicking the HOME Link it redirecting to the dotnethelpers/loaduserdetails instead of Dotnethelpers/LoadUserDetails

LowerCaseUrls in MVC Output2 -Dotnet-helpers

 

Keep Happy Coding !!!