Get Current Area Name in View or Controller

前端 未结 12 1583
闹比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:26

    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.

提交回复
热议问题