I need to display a controller in a classic asp page as an iframe.
<iframe src="http://localhost:55329/member/fund/?guid=<%=guid%>" width="100%" height="100%" border="0"></iframe>
I can display the Index page with no issues however when trying to create or edit the products, the page throw the following error:
in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN
To resolve the issue, I tried removing the X-Frame-Options and re-adding in the Base controller level:
protected override void OnActionExecuted(ActionExecutedContext filterContext)
{
Response.Headers.Remove("X-Frame-Options");
Response.Headers.Add("X-Frame-Options", "ALLOWALL");
base.OnActionExecuted(filterContext);
}
Instead it adds two X-Frame-Option this not resolving the issue.
I have seen and tested this fix which resolves the issue. However, I do not want to make change in the global setting. This fix was referred in previous questions
Any idea to resolve this?
I have override it on Result Executed:
protected override void OnResultExecuted(ResultExecutedContext filterContext)
{
filterContext.HttpContext.Response.Headers.Remove("X-Frame-Options");
filterContext.HttpContext.Response.Headers.Add("X-Frame-Options", "ALLOWALL");
base.OnResultExecuted(filterContext);
}
Hope this helps