Lowercase Routes in ASP.net MVC4

Back in MVC2 days I wrote a post on setting up a project with lowercase urls / redirecting and a workaround for IIS6. Luckily these days we have MVC4 which is a tad friendlier… to a degree.

In the Route collection registration area (Most likely in App_Start lest you've moved it) you can now simply add routes.LowercaseUrls = true; (http://msdn.microsoft.com/en-us/library/system.web.routing.routecollection.lowercaseurls.aspx )

The big bugger about this is (and theres a bug in codepex for it here http://aspnetwebstack.codeplex.com/workitem/685?PendingVoteId=685) when you add an MVC Area the bloody thing stops working.

In which case you'll want to use http://nuget.org/packages/LowercaseRoutesMVC4/ which does the trick.

Chris McKee

Chris McKee


Software Engineer, Web Front/Backend/Architecture; all-round tech obsessed geek. I hate unnecessary optimism

View Comments