How to get the current view name in asp.net MVC 3?

后端 未结 4 860
故里飘歌
故里飘歌 2020-12-01 12:46

How can I get the current view name regarding to current URL, in asp.net MVC 3 using Razor engine?

4条回答
  •  既然无缘
    2020-12-01 13:25

    You can get it from RequestContext.RouteData specifically, its Values collection contains "controller" and "action" keys i.e. RequestContext.RouteData.Values["controller"] RequestContext.RouteData.Values["action"]

提交回复
热议问题