Skip to main content
Home Forums Silverlight Programming Report a Silverlight Bug Silverlight Source cannot be fully qualified URL
4 replies. Latest Post by a2005 on April 10, 2009.
(0)
yvesc
Member
20 points
16 Posts
10-16-2008 3:05 PM |
I am trying to dynamically load an xap from a fully qualified URL instead of ClientBin but, although the documentation for the System.Web.UI.SilverlightControls.Silverlight class says "Use the Source property to specify the URL of the XAML source file or XAP source package.", I get a 404 error. Not sure if it's a bug or by design though. However it would be really nice to be able do this:
Imagine multiple web applications that have a different look and feel but you want to provide some common pages to all of them; using Silverlight would solve the presentation problem; then once you have the result in the Silverlight component, you can pass them to your calling page via the DOM.
Here is the code that works:
System.Web.UI.SilverlightControls.Silverlight sl = new System.Web.UI.SilverlightControls.Silverlight(); sl.Source = "ClientBin/CommonVehicleSilverlight.xap"; sl.ID = "CommonVehicleSilverlight"; sl.Width = new Unit(800); sl.Height = new Unit(600); sl.Windowless = true; SilverlightApp.Controls.Clear(); SilverlightApp.Controls.Add(sl);
If I replace line two by this, I get a 404:
sl.Source = "http://localhost/SilverlightApplication20/ClientBin/CommonVehicleSilverlight.xap";
I get a 404 from the browser as well even when I try to open it from IIS so I know I don't have any path resolution issue (the page is found if I change the extension). I tried to put a ".xap" application extension in IIS but I am not sure what executable I could use (assuming this would solve the problem).
I forgot to mention that this occurs when the 2 applications are in 2 different domains. It works if I use the same domain.
Would love to hear from the developement team to confirm if it is a bug or a "feature".
Thanks, Yves
preishuber
Contributor
3570 points
655 Posts
10-17-2008 6:13 AM |
if you can not download the xap in browser it can be a problem of missing mime type
add in iis the extension and set the type to application/x-silverlight-app
10-17-2008 9:39 AM |
Yes, Hannes, this did the trick. Why didn't I think of this?
Thanks a lot!
Yves
10-17-2008 9:41 AM |
Hannes, I tried to mark your post as answer but it did not work for some reason. You might want to try this.
Thanks again, Yves
a2005
37 points
39 Posts
04-10-2009 6:19 AM |
Does not work for me. I have IIS 7 where I have defined mime type for XAP To test if URL access issues, I tried "http://localhost/ClientBin/Test.xap". The browser (IE7) pops up "Save As" dialog. In the test page (generated by VS2008), I replace the source URL with above. It does not show anything.