How do you get the current area name in the view or controller?
Is there anything like ViewContext.RouteData.Values["controller"]
for areas?
How do you get the current area name in the view or controller?
Is there anything like ViewContext.RouteData.Values["controller"]
for areas?
In ASP.NET Core 1.0 the value is found in
ViewContext.RouteData.Values["area"];
In MVC 2 you can use
ViewContext.RouteData.DataTokens["area"]
I know this is a very very old post but we can use the Values Property exactly the same way as the DataTokens
Url.RequestContext.RouteData.Values["action"] worked for me.