Refused to display '' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN' [closed]

安稳与你 提交于 2019-12-13 04:46:31

问题


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

NOTE: i haven't done any line of code regarding 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'. 

回答1:


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");

    }


来源:https://stackoverflow.com/questions/26931853/refused-to-display-in-a-frame-because-it-set-x-frame-options-to-sameorigin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!