I have a .NET 3.5 application that makes a standard http WebRequest:

var webRequest = WebRequest.Create(new Uri("http://myserver.com/target.xml));
var webResponse = webRequest.GetResponse();

This application is often deployed within networks that utilize proxies but I never really had issues with this until it was recently deployed at a client that utilizes the "Blue Coat" Proxy/Firewall.

Their proxy is configured as a transparent proxy.

The issue is that 90% of the time, my WebRequests fail with 401 Unauthorized, yet sometimes they work fine (the behavior is the same on 10+ client machines).

Also, on all of them, it works completely fine if Internet Explorer is opened first and they manually browse to one of my URL's (I checked their IE config and no proxy config is entered). Consequently, all WebRequests from my application work seamlessly.

Their network team has no suggestions but does admit to have seen "funky" behavior in the past.

Anyone have any idea what's going on here and what could be done?


If you have no specific proxy defined, try this by default:

webRequest.Proxy = WebRequest.DefaultWebProxy;
webRequest.Proxy.Credentials = CredentialCache.DefaultNetworkCredentials;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.