Option 1: your ActionFilter can add information to the ViewModel , for example
filterContext.Controller.ViewData["YourKey"] = "Value to add";
Option 2: you can put the code in your base class Controller , which will find all the attributes that were applied to the executable method, and you can put them in a member variable that the Action method can use.
eg.
protected override void OnActionExecuting(ActionExecutingContext filterContext) { var attrs = filterContext.ActionDescriptor.GetCustomAttributes(true).OfType<Some>(); ... }
Edit: And, as others have noted, trying to change an attribute will not work.
source share