0
votes

I had an ASP.Net webpages site working fine (it's a booking application that people link to - a hosted service).

Some people just allowed a link to my site/application to open in a new window. Other embeded it within an IFrame on their site.

I have started updating it to MVC - however, the MVC version no longer works within an IFrame.

Is there any way, within IIS7.5 or within the controllers in MVC, to allow my application/site to display wihin an iFrame?

Thank you,

Mark

2
Do you have an example of what it is or isn't doing? Are you getting an error? Off the top of my head I can't think of any reason that the server-side technology (WebForms vs. MVC) should make any difference.Craig W.
Is MVC setting an X-Frame-Options response header automatically for you?Ian Gilroy
Hi - there is no error - the iframe window is just blank when looking at the MVC version. Also, there is no X-Frame-Options header being set - I checked that too, thanks.Mark
@MarkTait how did you solve it?Rolando

2 Answers

0
votes

Have you tried this? Link below claims if the iframe's source site has the following css, it produces a blank iframe.

html{ position: relative; }

Blank iFrame in IE

I've used iframes inside MVC apps before, so they do work. But, I've only used them within the same domain.

0
votes

It looks like Microsoft.NET updated MVC to automatically write out a SAMEORIGIN X-Frame-Option header that would supersede any attempts you've made to add your own custom headers.

This other Stack Overflow answer gave me the solution:

      After update to MVC 5, iframe no longer works

Also here's a blog post that details more about this issue:

      MVC5 prevents your website being loaded in an IFRAME