Get Current Area Name in View or Controller

前端 未结 12 1555
闹比i
闹比i 2020-11-29 00:50

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

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

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-29 01:24

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

提交回复
热议问题