ASP.NET MVC Pass object from Custom Action Filter to Action
The better approach is described by Phil Haack. Basically this is what you do: public class AddActionParameterAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { base.OnActionExecuting(filterContext); // Create integer parameter. filterContext.ActionParameters[“number”] = 123; // Create object parameter. filterContext.ActionParameters[“person”] = new Person(“John”, “Smith”); } } The only gotcha is that if you are creating object … Read more