Search code examples
c#asp.net-mvcrazor

Get Current Area Name in View or Controller


How do you get the current area name in the view or controller?

Is there anything like ViewContext.RouteData.Values["controller"] for areas?


Solution

  • From MVC2 onwards you can use ViewContext.RouteData.DataTokens["area"]