允许其他人 iframe 我的网站 [英] Allow others to iframe my site

查看:63
本文介绍了允许其他人 iframe 我的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果其他人尝试 iframe 我的网站,他们会收到错误拒绝在框架中显示,因为它将‘X-​​Frame-Options’设置为‘SAMEORIGIN’.他们必须改变什么,或者我,或者两者都改变​​?我发现 X-Frame-Options 有一些选项:SAMEORIGIN、DENY,并且只允许一个站点.配置:IIS8,ASP.NET MVC.是否有任何全局设置可以允许其他人对我的网站进行 iframe?

If others tries to iframe my site they get error "Refused to display in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN' ". Do they have to change something, or I, or both? I found there are options for X-Frame-Options :SAMEORIGIN,DENY,and allow only one site. Configuration :IIS8, ASP.NET MVC. Are there any global settings to allow others to iframe my site?

推荐答案

在您的 golbal.asax.cs 中将 X-Frame-Options 设置为 AllowAll:

In your golbal.asax.cs set X-Frame-Options to AllowAll:

 protected void Application_PreSendRequestHeaders()
 {
    Response.Headers.Remove("X-Frame-Options");
    Response.AddHeader("X-Frame-Options", "AllowAll");
 }

这篇关于允许其他人 iframe 我的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆