views:

32

answers:

0

The following code worked nicely until our admins enabled KERBEROS on our servers:

var image = new BitmapImage(new Uri("http://sharepoint/sites/Symbols/Symbols/ABCD.png"));

The server is in the local intranet zone and requires windows authentication. After our admins also enabled KERBEROS in this domain, http downloads and webservice calls failed. We fixed our WCF services by setting:

<transport clientCredentialType="Ntlm" />

Is there something similar for BitmapImages?

An alternative would be:

var image = new BitmapImage();
image.BeginInit();
var request = WebRequest.Create("Same url as above");
var credentials = new CredentialCache();
credentials.Add(new Uri("Same url as above", "NTLM", CredentialCache.DefaultNetworkCredentials);
request.Credentials = credentials;
image.StreamSource = request.GetResponse().GetResponseStream();
image.EndInit();

However it would be much nicer if we could just give the URL and WPF does the rest...

By the way, the exception we receive is:

WebException: 401 Unauthorized

Thanks!