当尝试使用Delicious来获取用户书签时,我得到的结果是“远程服务器返回了一个错误:NotFound。”。我已经看过了,但我找不到关于这个问题的更多细节。
这是我正在使用的代码。有人知道哪里会出错吗?
string fullUrl = "https://api.del.icio.us/v1/posts/all?";
WebClient client = new WebClient();
client.Credentials = new System.Net.NetworkCredential(Username, Password);
client.Headers[HttpRequestHeader.UserAgent] = "DeliciousWindowsPhoneClient";
client.DownloadStringAsync(new Uri(fullUrl));
client.DownloadStringCompleted += (object sender, DownloadStringCompletedEventArgs e) => {
if (e.Error == null)
{
XDocument xmlDocument = XDocument.Parse(e.Result);
callback(new DownloadXmlCompletedArgs(e) { Xml = xmlDocument });
}
else
{
callback(new DownloadXmlCompletedArgs(e));
}
lastConnectTime = System.DateTime.Now;
};发布于 2011-09-16 04:02:46
这是服务器响应错误,找不到。你仔细检查过URL了吗?尝试在浏览器中访问它。
如果浏览器可以工作,但代码不能工作,请尝试缩小发送的请求之间的差异。也许服务器需要特定的标头或cookie才能允许您访问?缩小范围的一个很好的工具是Fiddler。
https://stackoverflow.com/questions/7436770
复制相似问题