开发者

ASP.Net MVC Get Area Name

Given a Controller name, and a开发者_StackOverflow中文版 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜