Page view counter
SilverlightHost.Source issue
Last post 06-28-2008 8:20 PM by ahopper. 2 replies.
Sort Posts:
06-25-2008 1:25 PM
SilverlightHost.Source issue

I believe I have encountered a bug in the way the B2 drop calculates the value of SilverlightHost.Source (aka Application.Current.Host.Source) - if you point the Object tag's Source param or Silverlight.createObject at an .XAP served from a different site, the value of .Source incorrectly prepends the path to the folder hosting the .XAP to the full path to the .XAP itself.

Here's the steps to repro:
1. Create a new Silverlight B2 application ("MyApp") and select the option to use a Web to test it.
2. Add a TextBlock to the Grid in Page.xaml and name it "appSource"
3. In the constructor of the Page class, add the following code after the call to InitializeComponent():

   this.appSource.Text = Application.Current.Host.Source.ToString();

4. Run the application and verify that the TextBlock shows /ClientBin/MyApp.xap">http://localhost:<port>/ClientBin/MyApp.xap
5. Copy the .XAP to a web server other than the Web in your project (IIS comes in handy here - you can simply place it in wwwroot for the purpose of this repro).
6. Change the Source attribute of the Silverlight control in the test .aspx page to point to the new location (eg: http://localhost/SomeFolder/MyApp.xap)
7. Run the project again. Note that the TextBlock now displays http://localhost/SomeFolder/http://localhost/SomeFolder/MyApp.xap.

Andy Hopper
Senior Consultant
ahopper@wintellect.com

ahopper

Loading...
Joined on 06-25-2008
Posts 6
06-26-2008 4:37 PM
Marked as Answer
Re: SilverlightHost.Source issue

Indeed. I have filed a bug for this - thanks for reporting!

If this answers your question, please click on "Mark as Answer" on this post.

Sergey Volk MSFT

Loading...
Joined on 03-22-2008
Posts 98
06-28-2008 8:20 PM
Re: SilverlightHost.Source issue

Thanks, Sergey!

One more question; would this bug also affect downloads via WebClient/HttpWebRequest? I am seeing that no events get fired when I attempt to download files/images.

Andy Hopper
Senior Consultant
ahopper@wintellect.com

ahopper

Loading...
Joined on 06-25-2008
Posts 6
Microsoft Communities