Skip to main content
Home Forums General Silverlight Hosting and Streaming Issue with hosting Silverlight control in ascx page on Firefox 3 browser
9 replies. Latest Post by BCBlanka on November 12, 2009.
(0)
CRam
Member
4 points
11 Posts
06-21-2009 10:05 AM |
We have a Silverlight 2.0 application hosted within an ASP .Net web control (ascx page). The application works fine with Internet Explorer (6, 7, 8), but does not with Firefox 3 browser. We observe a blank page getting loaded, but when we right click on it, we observe the 'Silverlight' option in the context menu.Below is the markup of the form tag (with the name of the controls changed) on ascx control hosting the silverlight control. <form id="form1" style="height:100%;"> <div style="height:100%;"> <asp:Silverlight ID="XamlTest" runat="server" Source="~/ClientBin/Test.xap" MinimumVersion="2.0.31005.0" Width="990px" Height="500px" /> </div> </form>The 'form' tag cannot be marked with the attribute 'runat="server"', as the parent page already has another form with this attribute.We have not missed the registration of the System.Web.Silverlight assembly at the beginning of the ascx page.Any insight on what could go wrong with Firefox 3 browser would be very helpful.
ken tucker
All-Star
16322 points
2,492 Posts
06-21-2009 10:12 AM |
Give the div a height instead of a percent
<div style="height:500;"> <asp:Silverlight ID="XamlTest" runat="server" Source="~/ClientBin/Test.xap" MinimumVersion="2.0.31005.0" Width="990px" Height="500px" /> </div>
06-21-2009 11:48 PM |
Thanks, Ken, for the answer. I changed the height values of both the div and the form tags to 500px, and it seems to load most of the time, except the first time.
Also, I find a catch - this successful loading happens when the browser has internet connectivity (I'm working behind a proxy server - it works if the proxy setting is enabled in the browser). But, when I disable the proxy, I find the status message "connecting to go2.microsoft.com" for sometime, and then, it loads just a blank page.
This does not happen with IE, and it works even when proxy settings are disabled.
Any suggestions on what could be wrong would be very helpful.
06-22-2009 11:11 PM |
The above behavior was observed only for sometime. Accessing the application at a later point in time, we found that the behavior was the same as before - a blank screen, with the Silverlight context menu on right click.
We did further investigations on this. We tried hosting the Silverlight control in an ASPX page, instead of the ascx user control. We modified the user control to render an iframe (by overriding its Render method). The new ASPX page was given as the source for the iframe control. Even with this, the Silverlight control was not loading. Then, we tried accessing the new ASPX page directly from Firefox browser, and found that the Silverlight control was loading fine, but did not work, when hosted within the iframe on the page where we want it to be displayed.
We then installed a Firefox plug in named HttpFox, which was able to show the HTTP requests and responses from and to the browser. We compared the traffic in both cases, and found that there was a GET request for the xap control when the page was accessed directly, but this was missing when the page was hosted within the iframe control. We're confused as to why this was happening, and we're yet to find a solution to this problem.
Any insights on the causes to any of the problems would be very helpful indeed.
06-23-2009 5:48 AM |
I am not sure where you are hosting the silverlight app when being displayed in an iframe. I was wondering if the silverlight mime types were added for the place the iframe is hosted
http://blogs.technet.com/jorke/archive/2007/09/11/silverlight-mime-types-in-iis6.aspx
06-23-2009 6:03 AM |
Thanks, Ken, for following up on this thread and for helping. It's very kind of you! Thank you!
Yes, the page where the iframe is hosted and the Silverlight application are under the same virtual directory, and it has the Silverlight MIME type added as a HTTP header. And, it loads fine in IE too, but it doesn't in Firefox 3.
I'm also mentioning the versions of Firefox and Silverlight runtime that we're using to troubleshoot the problem (if that will make any difference): Firefox 3.0.11. Silverlight 2.0.40115.0
06-24-2009 11:24 PM |
The issue has been resolved. We were playing around with the styles for the form and div elements of the ASPX page hosted within the iframe. When we set a very large size, it happened that the Silverlight control took some space within the iframe, while there was space remaining within the iframe, where we got the right click context menu normally available for pages in a browser. On selecting "This frame" -> "Reload", the ASPX page within the iframe alone reloaded, and we observed the Silverlight control loading fine upon refresh! We also observed that the Silverlight control did not load if we refresh the whole page, instead of the iframe alone. We tried this from a number of machines to confirm if this was not a one off behavior. Then, we put in the code in the ASPX page which loads within the iframe, to programmatically refresh itself once (inside the page load handler), using Response.AppendHeader. We tried multiple delays after which to refresh the page, and finally found that it works fine with 0 seconds too. When we deployed with these changes for testing, it worked fine with both IE and Firefox.
I'm unable to explain the cause of this odd behavior with Firefox. But, I just thought I'd post the odd behavior that we had observed. Maybe, somebody might be able to explain, or, posting this might just help someone else at some point of time, if they hit upon such a strange behavior.
Many thanks to Ken, who followed up on this thread, and provided inputs to us, and did his best to help us out of this problem. Many thanks to everyone else who would have read this post and would have tried to help us too.
BCBlanka
2 Posts
11-12-2009 9:36 AM |
Hello,
I am getting the same error. Changing the width and height of the container div doesn't help in my situation. I have a silverlight application in an updatepanel and in firefox it will only start working after opening the plug-in twice.
Has anyone else encountered the same error and fixed it in a different way?
Thanks,
Blanka
Ken Tucker
11-12-2009 10:31 AM |
I would not put the silverlight app in an update panel. An update panel does not prevent a post back on the web page. It just limits what is redrawn. Any post back will cause the silverlight app to have to reload
11-12-2009 10:42 AM |
Thanks for the feedback.
I don't think there will be any problems because of the postback issue. The updatepanel is a light box and the silverlight control is the only control on that page. All other controls are inaccessible on the page while the updatepanel is active and the updatepanel's only control is the silverlight. And it's working like a charm in all IE browsers, only FF gives a bit of a headache.