Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 拒绝显示'';在帧中,因为它设置为';X-Frame-Options';至';SAMEORIGIN';_C#_Asp.net Mvc_Iframe - Fatal编程技术网

C# 拒绝显示'';在帧中,因为它设置为';X-Frame-Options';至';SAMEORIGIN';

C# 拒绝显示'';在帧中,因为它设置为';X-Frame-Options';至';SAMEORIGIN';,c#,asp.net-mvc,iframe,C#,Asp.net Mvc,Iframe,我做了一个MVC ASP.NETC项目,主要是一个表单 但是,当我创建正确的url时,它显示为空白 注意:我还没有编写任何关于iframe的代码 是否有一个选项我需要打开,使它有可能iframe FirefoxConsole Error message: Load denied by X-Frame-Options: http://localhost:2053/Persons/Create does not permit cross-origin framing. Chrome Error

我做了一个MVC ASP.NETC项目,主要是一个表单

但是,当我创建正确的url时,它显示为空白

注意:我还没有编写任何关于iframe的代码

是否有一个选项我需要打开,使它有可能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

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

    }

“iframe是正确的url”-你能解释一下吗?在线版本也不起作用。你能正常浏览到那个网址吗?(即不在iframe中),您能从iframe页面发布代码吗?对不起,我弄错了,现在修复了我的问题您已经完全更改了错误消息!gaaa我放弃了。我的情况:我在ASP.NET MVC 5中制作了一个应用程序,然后尝试在Sharepoint网站的iframe上进行渲染,我得到了这篇文章标题中所说的错误,根据你的回答,一切都很好。我想知道你在哪里找到这个答案的?只是为了将来的文档。“AllowAll”值是任何规范的一部分吗?如果此处未提及: