Skip to content

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

License

Notifications You must be signed in to change notification settings

digitaldjpool/lowercase-dashed-route

 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%