问题
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