Kyle
Kyle

Reputation: 33739

MVC Route specific URL to specific action?

I would like to keep the regular routing of area/controller/action/id

but have 1 extra url /login that goes to /account/account/login.(area named account, controller named account, action is login)

Is there a way I can specificy this routing? My client is requesting a shorter URL to the login page.

Upvotes: 2

Views: 2316

Answers (1)

Colin Bacon
Colin Bacon

Reputation: 15619

Yes you can simply create a route in the RouteConfig

Example

routes.MapRoute("Login", 
    "login", 
    new { controller = "account", action = "login" },
    new string[] { "MyApp.Areas.Account.Controllers" });

Upvotes: 1

Related Questions