Skip to main content

Microsoft Silverlight

Answered Question SilverlightHost.Source issueRSS Feed

(0)

ahopper
ahopper

Member

Member

2 points

6 Posts

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

Sergey Volk MSFT
Sergey V...

Participant

Participant

788 points

98 Posts

Microsoft
Answered Question

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.

ahopper
ahopper

Member

Member

2 points

6 Posts

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
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities