开发者

ASP.Net MVC Get Area Name

开发者 https://www.devze.com 2022-12-17 11:55 出处:网络
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.

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

精彩评论

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

关注公众号