我想在我的网站中禁用 x-frame-options,我希望没有其他网站可以使用 iframe 在他们的网页中显示我的网页。我的网站是在 ASP.net MVC3 中制作的,并托管在 IIS 7.5 中。
最佳答案
有很多方法可以解决这个问题。但最简单的方法之一是添加 <customHeaders>
部分添加到 web.config 并将该 header 附加到每个请求。
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-Frame-Options" value="DENY" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
关于asp.net - 在 MVC3 或 IIS 7.5 中禁用 x-frame-options,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23085306/