远程服务器返回了禁止的错误403. C#中的WebRequest [英] the remote server returned an error 403 forbidden. WebRequest in c#
本文介绍了远程服务器返回了禁止的错误403. C#中的WebRequest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用程序代码为:
My Application code Is:
public string test(string URL)
{
WebRequest objWebRequest = WebRequest.Create(URL.ToString());
objWebRequest.Method = "GET";
WebResponse objWebResponse = objWebRequest.GetResponse();
Stream objWebStream = objWebResponse.GetResponseStream();
using (StreamReader objStreamReader = new StreamReader(objWebStream))
{
csvValues += objStreamReader.ReadToEnd();
}
objWebStream.Close();
objWebResponse.Close();
return csvValues;
}
[edit]已添加代码块,忽略HTML ..."选项已禁用-OriginalGriff [/edit]
[edit]Code block added, "Ignore HTML..." option disabled - OriginalGriff[/edit]
推荐答案
http://en.wikipedia.org/wiki/HTTP_403 [
http://en.wikipedia.org/wiki/HTTP_403[^] - The web server is denying you access to that URL.
Perhaps the IP address you are using, is not allowed to access that resource. Check web server.
这篇关于远程服务器返回了禁止的错误403. C#中的WebRequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文