Skip to content

Instantly share code, notes, and snippets.

@Dynyx
Created June 4, 2012 13:21
Show Gist options
  • Save Dynyx/2868331 to your computer and use it in GitHub Desktop.
Save Dynyx/2868331 to your computer and use it in GitHub Desktop.
Get controller and action name in MVC
var controllerName = ViewContext.RouteData.Values["controller"].ToString().ToLower();
var actionName = ViewContext.RouteData.Values["action"].ToString().ToLower();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment