Asp.net
在 MVC3 或 IIS 7.5 中禁用 x-frame-options
我想在我的網站中禁用 x-frame-options,我希望沒有其他網站可以使用 iframe 在他們的網頁中顯示我的網頁。我的網站是用 ASP.net MVC3 製作的,託管在 IIS 7.5 中。
有很多方法可以解決這個問題。但最簡單的方法之一是將
<customHeaders>部分添加到 web.config 中,它將將該標頭附加到每個請求中。<configuration> <system.webServer> <httpProtocol> <customHeaders> <add name="X-Frame-Options" value="DENY" /> </customHeaders> </httpProtocol> </system.webServer> </configuration>