Which action is executing during an HtmlHelper extension method
I'm working on a menu-generating HtmlHelper extension method. This method will need to know which Action is being executed. So if Home/Index is executing, the extension method would show all links to other actions that're "coordinated." In a sense, all I need to know during the execution of the Home controller's Index action is the name of the Controller and the name of the Action that are being executed so that other logic can be executed. Is this possible?
var action = HtmlHelper.ViewContext.RouteData.Values["action"]; var controller = HtmlHelper.ViewContext.RouteData.Values["controller"];