In a MVC3 app, I need a global filter to get a value and before any controller is executed, however how can I get later that value from a Controller?
public class MyGlobalFilter : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
int i = 10;
}
}
I found that it's possible to set a new ViewBag value by the action controller context as the following code
filterContext.Controller.ViewBag.MyNewValue = 1