1、在controller中获取
RouteData.Values["controller"]
RouteData.Values["action"]
2、在视图中获取
ViewContext.RouteData.Values["controller"]
ViewContext.RouteData.Values["action"]
3、例如
localhsot:678/product/index/2
获取结果
ViewContext.RouteData.Values["action"] :index
ViewContext.RouteData.Values["controller"]:product
ViewContext.RouteData.Values["id"]:2
文章转载自:MVC中如何获取当前action、controller http://www.studyofnet.com/news/1195.html