拒绝在框架中显示“",因为它将"X-Frame-Options"设置为"SAMEORIGIN" [英] Refused to display '' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'
本文介绍了拒绝在框架中显示“",因为它将"X-Frame-Options"设置为"SAMEORIGIN"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经制作了一个MVC ASP.NET C#项目,该项目主要是一种表单.
I've made an MVC ASP.NET C# project which is mainly a form.
但是,当我对正确的网址进行设置时,它显示为空白
However when I iframe the correct url, it shows up as blank
注意:我尚未完成有关iframe的任何代码行
NOTE: i haven't done any line of code regarding iframe
我是否需要启用一个选项以使iframe成为可能?
Is there an option i need to turn on to make it possible to iframe?
FirefoxConsole Error message:
Load denied by X-Frame-Options: http://localhost:2053/Persons/Create does not permit cross-origin framing.
Chrome Error message:
Refused to display 'http://localhost:2053/Persons/Create' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
推荐答案
找到了解决方案:将其添加到global.asax.cs
found the solution: add this to global.asax.cs
protected void Application_PreSendRequestHeaders()
{
Response.Headers.Remove("X-Frame-Options");
Response.AddHeader("X-Frame-Options", "AllowAll");
}
这篇关于拒绝在框架中显示“",因为它将"X-Frame-Options"设置为"SAMEORIGIN"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文