Can I get the current executing controller from HttpContext?

前端 未结 2 1139
终归单人心
终归单人心 2021-02-14 18:32

I am using some 3rd party classes. I want to get the routevalues of my controller in that. Unfortunately it doesn\'t hand me the current controller that is executing. Can I get

2条回答
  •  南笙
    南笙 (楼主)
    2021-02-14 18:36

    You can search the values of "controller" and "action" in this object

    HttpContext.Request.RequestContext.RouteData.Values
    

提交回复
热议问题