Read / modify response to MVC action with filters
1 answer
On each of these action filters, you can get a result (object ActionResult
).
For OnResultExecuted
you can get it from propertyResultExecutedContext.Result
I've added a sample below.
public class InterceptValueAttribute : ActionFilterAttribute
{
public override void OnResultExecuted(ResultExecutedContext filterContext)
{
var result = filterContext.Result as ContentResult;
var data = result.Content;
//use data as required
}
}
You can use it for your actions as shown below.
[HttpPost]
[InterceptValue]
public string GetPerson()
{
string output = GetPerson();
return output;
}
+1
source to share