这是我的代码。我想要做的是连接到网络服务并将文件下载到特定位置。
代码抛出异常。看起来我应该在下载文件之前重新调整一些服务价值(不确定)。
WebClient webClient = new WebClient();
NetworkCredential netCred=new NetworkCredential();
netCred.UserName="user";
netCred.Password="pass";
netCred.Domain="domain";
webClient.Credentials = netCred;
WebProxy wp = new WebProxy();
wp.Credentials = netCred;
wp.Address = new Uri(@"http://okolje.arso.gov.si/service/prevozniki.zip");
webClient.Proxy = wp;
webClient.DownloadFile("http://okolje.arso.gov.si/service/prevozniki.zip", @"C:\arso\prevozniki.zip");