/lowercase-dashed-route

Makes ASP.NET MVC routes dashed (hyphenated) and lowercase i.e. yoursite.com/account/user-profile [Updated]

Primary LanguageC#MIT LicenseMIT

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.

Install

Install-Package **LowercaseDashedRouteEx**

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