Tuesday, August 18, 2015

Problem with Lowercase Urls in ASP.NET MVC

As of ASP.NET MVC 4 and beyond, you can change all of your Url Routes to be in lowercase.

However, after I was going through a recent debugging session with Microsoft, doing this has 2 unintended side effects:

  1. Every time I navigate to a Url, the Url is rendered as a 302 redirect in a Fiddler Trace rather than a 200 response in order to display the lowercase Url route.
  2. Any information associated with the non-lowercase Url (such as WIF Session based cookies) are lost because of the route Url context switch!
These changes can be made easily in your ASP.NET MVC Web Application by modifying your RouteConfig.cs file as outlined in this article :

http://gurustop.net/blog/2012/09/01/asp-net-mvc-seo-lowercase-url-iis-rewrite-net45-nuget/

However, since this feature does not work as intended even in ASP.NET MVC 5, it is best to fully verify your application through a Fiddler Trace and IIS Logging before using this feature in your ASP.NET MVC Web Application!!

No comments:

Post a Comment