strike_noir
strike_noir

Reputation: 4174

how to custom route in asp.net mvc 4

I want to create a custom route that routes like this

when the client request http://server/logout it will be directed to to AccountController controller and to LogOff method

How to do this in ASP.MVC 4?

Upvotes: 2

Views: 538

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038810

You could insert the following route definition before the default route:

routes.MapRoute(
    name: "LogOut",
    url: "logout",
    defaults: new { controller = "Account", action = "LogOff" }
);

Upvotes: 4

Related Questions