Friday, January 23, 2009

Proxy Authentication Required

Problem I'm coding up a Live Mesh sample.  I'm using Visual Studio to attempt to create a programmatic link to the Mesh.  I run it.  It was failing.
Explanation (407) Proxy Authentication Required.

So, my app was attempting to authenticate to the Windows Live Passport service, but the Telecom Web Proxy wasn't allowing my credentials through.  I needed a way of tunneling through the Telecom Web Proxy.
Solution // Set the system proxy with valid server address or IP and port
System.Net.WebProxy pry = new System.Net.WebProxy("", 8080);
// The DefaultCredentials automatically get username and password
pry.Credentials = CredentialCache.DefaultCredentials;

// Deprecated: GlobalProxySelection.Select = pry;

WebRequest.DefaultWebProxy = pry;

No comments:

Post a Comment