We deliberately did not find a way to get the current area name from the MVC request, since "area" is just a route attribute. This is unreliable for other purposes. In particular, if you want your controllers to have some attribute (think of an abstract term, not the System.Attribute class) that the helper can use, then these attributes should be found by the controllers themselves, and not in this area.
As a practical example, if you want some logic (for example, an action filter) to run in front of any controllers in a certain area, you must associate the action filter with these controllers directly. The easiest way to do this is to associate some MyAreaBaseController with this filter, and then each controller that you logically want to associate with this scope to subclass this type. Any other use, such as a global filter, that looks at RouteData.DataTokens ["area"] for a decision, is unsupported and potentially dangerous.
If you really need to get the current area name, you can use RouteData.DataTokens["area"] to find it.
Levi
source share