A new property to RouteCollection was added with .NET Framework 4.5:
http://msdn.microsoft.com/en-us/library/system.web.routing.routecollection.lowercaseurls.aspx
This works great, until you add an Area to your project. All Urls are propercase again.
Any ideas why this happens? It's simple to reproduce:
- Create new MVC 4 Internet Application (.NET 4.5)
- Start RouteConfig.RegisterRoutes function with: routes.LowercaseUrls = true;
- Run the project and you'll see all generated Urls are now lowercase.
- Add an Area to the project.
- Run the project again and you'll see all Urls are propercase again!
It breaks at the point where context.MapRoute gets executed in AreaRegistration.RegisterArea. When I comment that out, I got lowercase Urls. Uncomment it, and the propercase Urls are back.
It seems to me like Microsoft knows this is buggy and doesn't advertise this new feature, as it's a really great feature but it is only mentioned in the MSDN docs.