1. 首页
  2. 数据库
  3. 其它
  4. Asp.net MVC中获取控制器的名称的方法

Asp.net MVC中获取控制器的名称的方法

上传者: 2021-01-31 02:18:30上传 PDF文件 40.57KB 热度 7次
1、视图中 string controller = ViewContext.RouteData.Route.GetRouteData(this.Context).Values[controller].ToString(); string controller = ViewContext.RouteData.Values[controller].ToString(); 2、控制器的action中 string controller = RouteData.Route.GetRouteData(this.HttpContext).Values[controller].T
下载地址
用户评论