views:

189

answers:

2

My silverlight app needs to get back to the host from whence it came for its data. How do I get the webclient to connect back to the root of that site.

For example, my silverlight xap is sitting in an Amazon S3 bucket and loaded via an HTML file in that same bucket. I want to do a http://mybucket.s3.amazonaws.com/ and then act on the xml that is returned from that GET.

+3  A: 

Use System.Windows.Application.Host - see the documentation, which contains this example:

"The following example shows how to use Host to get the path to the Silverlight application package."

<UserControl x:Class="SilverlightApplication.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;

    <Grid>
        <TextBlock Text="{Binding Source}" />
    </Grid>

</UserControl>
RichieHindle
Thanks for the documentation link. It adds to the value of the answer.
Ralph Shillington
A: 

Application.Current.Host.Source in C#