我正在尝试使用此网址为用户提取Digg数据:
“http://services.digg.com/user/vamsivanka/diggs?count=25&appkey=34asd56asdf789as87df65s4fas6”
并且Web响应引发错误“远程服务器返回错误:(403)禁止。”
请告诉我。
public static XmlTextReader CreateWebRequest(string url)
{
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.UserAgent = ".NET Framework digg Test Client";
webRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;
webRequest.Accept = "text/xml";
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
System.IO.Stream responseStream = webResponse.GetResponseStream();
XmlTextReader reader = new XmlTextReader(responseStream);
return reader;
}