我正在尝试从我的提供商处下载文件。
url 受基本用户名和密码保护,所有内容都通过 ssl 发送。
所以我尝试这样做:
WebClient proxy = new WebClient();
proxy.DownloadStringCompleted += (o, dscea) => System.Diagnostics.Debugger.Break();
proxy.Credentials = new NetworkCredential("username", "password");
proxy.DownloadStringAsync(new Uri("https://..../.../data.xml"));
如您所见,我尝试验证。url 是正确的,当我尝试从 twitter 下载一些东西时,代码可以工作。
当我在 Firefox / Internet Explorer 中输入 URL 时,该 URL 有效
我忘记连接到这个 xml 文件是什么?
我得到的错误如下:
- [System.Net.WebException] {"[HttpWebRequest_WebException_RemoteServer]\r\nArguments:NotFound\r\n调试资源字符串不可用。键和参数通常提供足够的信息来诊断问题。请参阅 http://go.microsoft.com /fwlink/?linkid=106663&Version=3.7.50308.0&File=System.Windows.dll&Key=HttpWebRequest_WebException_RemoteServer "} System.Net.WebException
我正在使用 Visual Studio 2010(完整版,而不是 Express)和 CTP 刷新 :)