I have an ActionFilterAttribute
which I want to accept parameters through but I can't figure out pass them across.
So my action filter looks like this;
public class PreventAction : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
filterContext.Result = new RedirectResult("Home/Index");
}
}
And I decorate my action like so;
[PreventAction]
public ActionResult Ideas()
{
return View();
}
Now I want to add a parameter so I can call the filter like this;
[PreventAction(myParam1 = "1", myParam2 = "2")]
public ActionResult Ideas()
{
return View();
}
Anyone know how to do this?