The following code works for me:
var webProxy = WebProxy.GetDefaultProxy();
webProxy.UseDefaultCredentials = true;
WebRequest.DefaultWebProxy = webProxy;
Unfortunately, WebProxy.GetDefaultProxy() is deprecated. What else should I be doing?
(using app.config to set the defaultProxy settings is not allowed in my deployment)