There is a requirement to render the publically available web site content inside SharePoint application pages, dynamically based on arbitrary condition. This can be done in two ways. The first option is to use the page viewer web part and dynamically set the url of page viewer using a user control tied to the master page. The second option is to design an application page and render the external content using IFrames. The option of application pages + Iframes is better compared to dynamic page viewer web part way, considering many pros and cons.
The best way to achieve this to have an ASP.NETuser control that hosts the IFrame. Then host the entire user control inside the application page. Because user control gives the more control and flexibility to manipulate the properties of Iframes at run-time, than finding the logical event of ASP.NET page life-cycle and accomplish this task.
. On the page load of user control, add the src property of the user control
protected void Page_Load(object sender, EventArgs e) { this.IFrame1.Attributes.Add("src", ThirdPartyUrl); }
Pingback: Render Iframes dynamically inside SharePoint Application Pages - My experiments with SharePoint, Azure and .NET using Visual Studio