What may cause System.Net.WebException: The remote server returned an error: (407) Proxy Authen开发者_JAVA百科tication Required. Windows webclient on Windows 7 virtual machine
WebClient client = new WebClient();
client.DownloadFile(Uri, "test.html"); // fails
string html = client.DownloadString(Uri); // fails
I can't see any proxy settings in Internet Explorer and on the same box Com Automation driven from Visual Foxpro works without any proxy.
oxmlhttp = createobject("microsoft.xmlhttp")
oxmlhttp.open('GET', lcURL, .t.)
oxmlhttp.send()
Once rebooting box made it disappear , but right now after rebooting it persists.
Not sure how robust it is but adding these lines before invoking download solved my problem.
IWebProxy theProxy = client.Proxy;
if (theProxy != null)
{
theProxy.Credentials = CredentialCache.DefaultCredentials;
}
精彩评论