Blankman
Blankman

Reputation: 266950

From within a Controller's action, how can I get the current route information?

From within a Controller's action, how can I get the current route information?

How can I loop through the other routes?

Upvotes: 2

Views: 212

Answers (1)

Matt Kocaj
Matt Kocaj

Reputation: 11535

RouteData is a key/value collection:

this.RouteData.Values["controller"];

..will return the controller of the current route.

this.RouteData.Values["action"];

..will return the action, etc..

Upvotes: 3

Related Questions