We are using an internal HTML-based single sign on page to authenticate users. In order to avoid reloading the Silverlight application into memory twice, we are rendering this login page inside of a dynamically generated IFRAME that Silverlight generates. This single sign on HTML page is located on a different server than our Silverlight application’s XAP file.
private HtmlElement _loginFrame;
_loginFrame = HtmlPage.Document.CreateElement("iframe");
_frameWindow = _loginFrame.GetProperty("contentWindow") as HtmlWindow;
_loginFrame.AttachEvent("onload", new EventHandler<HtmlEventArgs>(OnHtmlFrameContentLoaded));
Now inside of the OnHtmlFrameContent loaded event handler I attempt to obtain a reference to the HtmlDocument object.
HtmlDocument doc = this._frameWindow.GetProperty("document") as HtmlDocument;
Unfortunately, doc is always null. I suspect that this is because the IFRAME is being pointed at a domain that is different than the main HTML container’s domain.