title: ASP.NET MVC Equivalent to "override void Render" from ASP.NET WebForms
body: <p>What is the ASP.NET MVC equivalent to "override void Render" from ASP.NET WebForms?
  Where are you opportunities to do some last-minute processing before the output is sent to the client?  </p>
  
  <p>For example, I wouldn't use this in production code, but illustrates cleaning up the <code>&lt;title&gt;</code> and <code>&lt;head&gt;</code> markup for an entire site when placed in the MasterPage of a WebForms app. </p>
  
  <pre><code>    protected override void Render(HtmlTextWriter writer)
      {
          System.IO.StringWriter sw = new System.IO.StringWriter();
          HtmlTextWriter htw = new HtmlTextWriter(sw);
          base.Render(htw);
          htw.Close();
          string h = sw.ToString();
          string fhtml = h.Replace("&lt;title&gt;\r\n\t", "\n&lt;title&gt;")
                               .Replace("\r\n&lt;/title&gt;", "&lt;/title&gt;")
                               .Replace("&lt;/head&gt;","\n&lt;/head&gt;");
          // write the new html to the page
          writer.Write(fhtml);
      }
  </code></pre>
  
  <p>What is the best approach for playing with the final text rendering in ASP.NET MVC?</p>
  
  <p><strong>UPDATE:</strong><br>
  So looking at the link (the chart) that Andrew Hare mentioned it looks you could do this in the View Engine. Can you bolt things onto or alter the way the default View Engine works or do you have to replace the whole thing?   </p>