问题描述
我在我的项目的MVC的版本更新为5,现在的iFrame不加载,我得到这个错误:
I updated my project MVC version to 5 and now iFrame does not load, I get this error:
负载用X帧选项否认:www.blahblah.com不允许跨域帧
我注意到,由于某种原因,现在的X框架 - 选项头有SAMEORIGIN充满不允许的iframe从不同的域加载页面。这是一个问题,我为我制定遏制和继承页两者。我试图在IIS一切这个头改变无济于事。
I noticed that for some reason now the X-Frame-Options header has SAMEORIGIN filled which does not allow the iframe to load a page from a different domain. This is a problem for me as I develop both the containing and inheriting page. I tried everything in IIS to change this header to no avail.
任何人都遇到过这个吗?
Anyone encountered this yet?
推荐答案
我终于找到了答案。与MVC 5起微软决定,缺省设置SAMEORIGIN在那里。我发现最好的方法写在下面把这个标签关在的Global.asax.cs
I finally found the answer. Starting with MVC 5 Microsoft decided to set SAMEORIGIN in there by default. The best way I found to turn this tag off is by writing the following in the Global.asax.cs
protected void Application_Start()
{
//Bundles and stuff are here
AntiForgeryConfig.SuppressXFrameOptionsHeader = true;
}
这篇关于更新MVC 5之后,IFRAME不再起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!