Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable x-frame-options in MVC3 or IIS 7.5

I want to disable x-frame-options in my website, I want that no other website can show my webpages in their web pages using iframes. My website is made in ASP.net MVC3 and hosted in IIS 7.5.

like image 769
aadi1295 Avatar asked Apr 15 '14 13:04

aadi1295


1 Answers

There are a bunch of ways to go about this. But one of the easiest is adding <customHeaders> section to the web.config and it will append that header to each request.

<configuration>
   <system.webServer>
      <httpProtocol>
         <customHeaders>
            <add name="X-Frame-Options" value="DENY" />
         </customHeaders>
      </httpProtocol>
   </system.webServer>
</configuration>
like image 132
Steven V Avatar answered Sep 21 '22 23:09

Steven V