The controller will receive an instance before the Action Filter OnActionExecuted and OnActionExecuting events are triggered. You can also access the controller through the filterContext parameter, which is passed to event handlers.
public class TestActionAttribute : FilterAttribute, IActionFilter { #region IActionFilter Members public void OnActionExecuted(ActionExecutedContext filterContext) { var controller = filterContext.Controller; } public void OnActionExecuting(ActionExecutingContext filterContext) { var controller = filterContext.Controller; } #endregion }
source share