使用WebClient下载时需要身份验证

时间:2015-10-22 03:04:55

标签: c# web

我可以转到http://bsb.apca.com.au/public/BSB_DB.NSF/publicBSB.xsp,然后点击“下载BSB”并继续下载以下文件: http://bsb.apca.com.au/public/CS4BSBDir.nsf/0/B895ACB64BE7D0EECA257ED1001108BE/ $文件/ BSBDirectorySept15-234.csv

我正在尝试以编程方式执行此操作,如下所示,但是我收到此错误:

An unhandled exception of type 'System.Net.WebException' occurred in System.dll

Additional information: The remote server returned an error: (407) Proxy Authentication Required.

var client = new WebClient();
client.UseDefaultCredentials = true;
client.DownloadFile("http://bsb.apca.com.au/public/CS4BSBDir.nsf/0/B895ACB64BE7D0EECA257ED1001108BE/$File/BSBDirectorySept15-234.csv", @"C:\temp\csvTest.csv");

0 个答案:

没有答案