Search code examples
asp.netiframe

ASP.NET dynamic iframe on IIS


I know they are bad practice but I have a real need on an internal website for an iframe. I achieved this using the following code behind code on the go button and the iframe html code below.

frame1.Visible = true;
frame1.Attributes["src"] = "http://freckles/bksb_ict/frmDiagnostic.aspx?" + args;

<iframe id="frame1" scrolling="auto" style="position:absolute; top:0; left:0;   height:100%; width:100%;" runat="server" visible="False">
 </iframe> 

This worked in visual studio and showed the iframe covering the whole screen as expected but when deployed on iis failed with Server Application Unavailable shown in the iframe.

The reason I set the src dynamically is the initial page is a search, pressing one of the displayed buttons obtains the correct args to send to the iframe.

Any ideas if this can be worked around. I have seen a possible alternative involving an object tag but am unsure if it will end up with the same error.


Solution

  • I solved this in the end, my code actually worked. Turned out when it was deployed there was a mismatch of asp.net versions in the same application pool. It didn't cause a problem until the attempt to display both pages at the same time. Separating them into different application pools fixed it.