我正在尝试从 url 下载文件。但即使在提供网络凭据后,下载的文件也将是登录页面。
WebClient downloader = new WebClient();
NetworkCredential myCred = new NetworkCredential(
"username", "password", "abc.com");
downloader.Credentials = myCred;
downloader.DownloadFileCompleted += new AsyncCompletedEventHandler(downloader_DownloadFileCompleted);
downloader.DownloadProgressChanged += new DownloadProgressChangedEventHandler(downloader_DownloadProgressChanged);
downloader.DownloadFileAsync(new Uri(url), "C://Desktop/File_extracted.doc");
这是我用来下载文件的代码。如何获取该网址中的文件。