title: Adding X-Frame-Options header to all pages in MVC 4 application
body: <p>I am trying to add the X-Frame-Options header (with value set to "DENY") into my MVC 4 application. I looked around and it seems <a href="http://web.archive.org/web/20130921220931/http://blog.codinginertia.com/130/prevent-clickjacking-in-asp-net-mvc">this</a> is the cleanest way to add for all pages.</p>
  
  <p>However when I add this code it will not build.  With an error on <code>OnResultExecuting</code> of </p>
  
  <blockquote>
    <p><em>"no suitable method found to override."</em></p>
  </blockquote>
  
  <pre><code>public class XframeOptions : ActionFilterAttribute
  {
      public override void OnResultExecuting(
            System.Web.Mvc.ResultExecutingContext filterContext)
      {
          filterContext.HttpContext.Response.AddHeader(
              "X-Frame-Options", "DENY");
      }
  }
  </code></pre>
  
  <p>If this is the cleanest way to do this how can I resolve this error?  Is there a better way to handle this in an MVC 4 application?</p>