Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Lowercase routes

Necroskillz edited this page Sep 14, 2010 · 3 revisions

Lowercase urls, in my opinion, look more professional than standard routes provided by the default MapRoute() method. I created extension method MapLowercaseRoute() that allows you to have urls like this

http://www.example.com/home/about

instead of this

http://www.example.com/Home/About

Usage

Simply use routes.MapLowercaseRoute() instead of routes.MapRoute() when registering routes.

routes.MapLowercaseRoute(
	"SomeRoute",
	"{controller}/{action}/{id}",
	defaults: new { controller = "Home", action = "Index" },
	constraints: new { id = @"\d+" }
);
Clone this wiki locally