Reputation: 5063
From the http context class is there a method to get the current Controller name?
Upvotes: 5
Views: 7575
Reputation: 12025
Yes, you can do something like that
HttpContext.Current.Request.RequestContext.RouteData.Values["controller"].ToString();
If you're in a view, then you can do:
ViewContext.RouteData.Values["Controller"]
Upvotes: 11