Makes ASP.NET MVC routes dashed (hyphenated) and lowercase i.e. yoursite.com/account/user-profile
C#
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LowercaseDashedRouting Fixed broken Area support. Apr 21, 2014
.gitattributes
.gitignore
LICENSE
LowercaseDashedRoute.sln
README.md

README.md

lowercase-dashed-routing

lowercase-dashed/hyphenated-routing-for-asp-net-mvc/like-this

Download.

See ata's blog post & discussion

Requires .NET 4.0 or .NET 4.5.

What is new in 1.1 ?

New: Support for 'namespace' constraints are added.
New: Added support for Areas.
New: Many new overloads for the class constructor.

Example

If you use: Html.ActionLink("User Profile", "UserProfile", "Account")

Without Lowercase Dashed Route the url is:
yoursite.com/Account/UserProfile

With Lowercase Dashed Route the url is:
yoursite.com/account/user-profile

Initial Configuration

Open RouteConfig.cs in App_Start folder. Comment out old routes.MapRoute(...) call and instead use:
routes.Add(new LowercaseDashedRoute("{controller}/{action}/{id}",
    new RouteValueDictionary(
        new { controller = "Home", action = "Index", id = UrlParameter.Optional }),
        new DashedRouteHandler()
    )
);

If you are using areas, use the code below in your XxxAreaRegistration.cs file instead of default one and replace "AreaName"s with yours:

var route = new LowercaseDashedRoute("AreaName/{controller}/{action}/{id}",
        new RouteValueDictionary(
            new
            {
                action = "Index",
                id = UrlParameter.Optional
            }),
        new DashedRouteHandler(),
		this,
		context
    );
context.Routes.Add("AreaName_default", route);

Developers:
Ata Sasmaz
Salar Khalilzadeh

githalytics.com alpha