ASP.NET MVC Lowercase URLs

Something handy you can apply via the routing engine in ASP.NET MVC is to set all URLs to lowercase.

I find it very messy and unprofessional when I see random mixtures of upper & lower case URLs in any website or web application.

Use the following code to set all URLs to lowercase:

routes.LowercaseUrls = true;

You do this in your RegisterRoutes method in the RouteConfig class, your function should look like this:

public static void RegisterRoutes(RouteCollection routes)

    routes.LowercaseUrls = true;

        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }

Source: How can I have lowercase routes in ASP.NET MVC?


Published by

Alan Feekery

Developer, Gamer, Musician, Cyclist and big Motorsport fan... enjoys the odd cup of coffee :)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s