views:

215

answers:

1

Ok, here is the situation. I would like to deploy a silverlight application to an enterprise portal. Users will access the application by logging in to the portal and navigating to the page where it is hosted. That's the easy part.

This silverlight 4 application is designed to be run in Out of Browser mode (OOB). My question is, is it possible to have the Silverlight OOB update process retrieve updates from behind the enterprise portal's authentication?

When I call App.Current.CheckAndDownloadUpdateAsync();, how do I supply credentials so that this HTTP request will succeed?

Any ideas? Is the update process extensible?

Thanks for your help.

A: 

With Silverlight 4 this should be a possible scenario

In both classes WebClient and WebRequest you can use Credentials..

private void DownloadAdditionalThings()
{
    WebRequest.RegisterPrefix("http://", System.Net.Browser.WebRequestCreator.ClientHttp);
    var client = new WebClient();
    client.UseDefaultCredentials = false;
    client.Credentials = new NetworkCredential("username", "password");
    client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
    client.DownloadStringAsync(new Uri("http://blog.gfader.com/"));
}

private void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
    string result = e.Result;
}
Peter Gfader
Peter, thanks for your response. So how can I make sure the right instance of either the WebClient or WebRequest classes gets used when I call App.Current.CheckAndDownloadUpdateAsync() ?
Daveed
Mhm.... Was the first download/install of the app over an authenticated connection?
Peter Gfader
Yes, when the app is first accessed and installed the user would have logged into the portal.
Daveed
Shouldn't Silverlight use the exact same "metadata" (credentials, URL, headers, ...) on your connection to connect again later... I would file a bug/feature request on Connect. http://connect.microsoft.com/
Peter Gfader