Hi I am developing website using asp .net mvc5 but when I am using IFrame it is not showing any results. After googling and reading some documents I have found that MVC5 stops Iframe by default. I have found some answers on stackoverflow and other blogs but nothing works for me. Please check where I am doing mistake:
Here is my Code:
public ActionResult Index()
{
return View();
}
My View:
<iframe width="482" height="500" scrolling="no" frameborder="0" id="paymentFrame" src="http://www.codingfusion.com"></iframe>
I have tried following solutions so far:
After update to MVC 5, iframe no longer works
https://www.iambacon.co.uk/blog/mvc5-prevents-your-website-being-loaded-in-an-iframe
http://joost.haneveer.nl/asp-net/display-mvc-5-web-site-in-an-iframe/
Here is my Global.asax file:
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
// MVC5 generates the "X-Frame-Options SAMEORIGIN" header by default, the following line disables the default behaviour
System.Web.Helpers.AntiForgeryConfig.SuppressXFrameOptionsHeader = true;
}
protected void Application_BeginRequest()
{
Response.AddHeader("X-Frame-Options", "DENY");
}