Getting controller name from razor

前端 未结 6 492
旧时难觅i
旧时难觅i 2020-12-03 13:11

I seem to be having a difficult getting something that should be easy. From within my view, using Razor, I\'d like to get the name of the current controller. For example, if

6条回答
  •  执笔经年
    2020-12-03 13:50

    Also if you want to get the full controller's name (with "Controller" ending) you can use:

    ViewContext.Controller.GetType().Name
    

提交回复
热议问题