I am trying to modify the output stream to search/replace some XHTML tags returned from a View. I could use an traditional ASP.NET response filter, but thought to try the ASP.NET MVC action filter first.
public class MyResultFilter : ActionFilterAttribute
{
public override void OnResultExecuting(ResultExecutingContext filterContext)
{
base.OnResultExecuting(filterContext);
}
public override void OnResultExecuted(ResultExecutedContext filterContext)
{
ViewResult viewResult = filterContext.Result as ViewResult;
Debug.WriteLine("OnResultExecuted");
base.OnResultExecuted(filterContext);
}
}
I'm having trouble determining how to modify or get ahold of the viewResult output stream. Examples on the web only show logging basic properties, never modifying the result.