Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在我的网站中禁用 x-frame-options,我希望没有其他网站可以使用 iframe 在他们的网页中显示我的网页。我的网站是用 ASP.net MVC3 制作的,托管在 IIS 7.5 中。
有很多方法可以解决这个问题。但最简单的方法之一是将<customHeaders>部分添加到 web.config 中,它将将该标头附加到每个请求中。
<customHeaders>
<configuration> <system.webServer> <httpProtocol> <customHeaders> <add name="X-Frame-Options" value="DENY" /> </customHeaders> </httpProtocol> </system.webServer> </configuration>