X-Frame-Options 否认根本不工作
X-Frame-Options Deny not working at all
我尝试了很多方法来拒绝 X-Frame-Options
禁止从我的网站加载 iframe 但没有成功。
通过 http header:
<meta http-equiv="X-Frame-Options" content="deny">
javascript:
<script type="text/javascript">
if ( window.self !== window.top ) {
window.top.location.href=window.location.href;
}
</script>
web.config:
X-Frame-Options: DENY
none 这些工作,所以问题是最好的解决方案是什么?为什么这些在我的网站上不起作用? (注意:我不能直接访问IIS,只能编辑web.config或添加一些代码到网站)
ASP.net VB.net - IIS
如果你想阻止它 site-wise 那么只需在你的 global.asax
中添加一个 header
protected void Application_BeginRequest()
{
Response.AddHeader("X-Frame-Options", "DENY");
}
如果您想在特定的 request/response 上进行,那么
Response.AddHeader("X-Frame-Options", "DENY");
我尝试了很多方法来拒绝 X-Frame-Options
禁止从我的网站加载 iframe 但没有成功。
通过 http header:
<meta http-equiv="X-Frame-Options" content="deny">
javascript:
<script type="text/javascript">
if ( window.self !== window.top ) {
window.top.location.href=window.location.href;
}
</script>
web.config:
X-Frame-Options: DENY
none 这些工作,所以问题是最好的解决方案是什么?为什么这些在我的网站上不起作用? (注意:我不能直接访问IIS,只能编辑web.config或添加一些代码到网站)
ASP.net VB.net - IIS
如果你想阻止它 site-wise 那么只需在你的 global.asax
中添加一个 headerprotected void Application_BeginRequest()
{
Response.AddHeader("X-Frame-Options", "DENY");
}
如果您想在特定的 request/response 上进行,那么
Response.AddHeader("X-Frame-Options", "DENY");