I have a controller. On the controller's post method, there is a variable (an object variable) I want to pass to my action filter: the method:
public void OnActionExecuted(ActionExecutedContext context)...
Any suggestions on how achieve this?
I have a controller. On the controller's post method, there is a variable (an object variable) I want to pass to my action filter: the method:
public void OnActionExecuted(ActionExecutedContext context)...
Any suggestions on how achieve this?
Use HttpContext.Items. It's a key / value collection that exists for the duration of a single request.
In your controller, add something:
HttpContext.Items["Something"] = "something I need later";
Then in the OnActionExecuted method pull it out:
var something = context.HttpContext.Items["Something"] as string;
Everything you pull out will be of type object so make sure you cast it to what it was.