ETFairfax
ETFairfax

Reputation: 3814

ASP.Net MVC Get Area Name

Given a Controller name, and a Action name - "AdminController", "Index" for example, is it possible for me to get back all the possible Areas.

Does that make any sense to anyone?

Cheer,

ETFairfax.

Upvotes: 0

Views: 828

Answers (1)

Levi
Levi

Reputation: 32828

It's not really supported to do this. In MVC 2, controllers aren't associated with areas. The way the implementation works is that the route is associated with a set of namespaces, and the controller factory looks only in those namespaces for a controller type to service the request. So there's no direct mapping from a controller to an area.

If you explain a little bit more on what you're trying to do, perhaps we can find an alternative method for getting you unstuck.

Upvotes: 2

Related Questions