Lowercase URL

Imported from the CodePlex archive for reference purposes. Support for MvcCodeRouting has ended.

Commented on

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

Commented on link

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()
   }
); 

Commented on link

Excellent, thanks!