Refused to display '' in a frame because i

2019-08-28 09:54发布

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条回答
ら.Afraid
2楼-- · 2019-08-28 10:49

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

    }
查看更多
登录 后发表回答