title: How to use ASP.NET MVC ActionFilterAttribute/IResultFilter to modify output
body: <p>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.</p>
  
  <pre><code>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);
      }   
  }
  </code></pre>
  
  <p>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.</p>