This project is read-only.

Lowercase URL

Jan 12, 2012 at 9:40 PM

Is there a way to specify lowercase route values something similar to http://lowercaseroutesmvc.codeplex.com/?

Jan 12, 2012 at 9:51 PM

Yes, like this:

routes.MapCodeRoutes(
   rootController: typeof(Controllers.HomeController),
   settings: new CodeRoutingSettings {
      RouteFormatter = (args) => args.OriginalSegment.ToLowerInvariant()
   }
); 

You can even use hyphens or underscores:

routes.MapCodeRoutes(
   rootController: typeof(Controllers.HomeController),
   settings: new CodeRoutingSettings {
      RouteFormatter = (args) => Regex.Replace(args.OriginalSegment, @"(\B[A-Z])", "-$1").ToLowerInvariant()
   }
); 

Marked as answer by maxtoroq on 10/15/2013 at 10:06 AM
Jan 12, 2012 at 10:57 PM

Excellent, thanks!