HttpWebRequest 远程服务器返回错误: (403) 已禁止。 求高手帮帮忙 该怎么解决 非常感谢

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);

  //req.Method = "POST";
  req.KeepAlive = true;
  req.ContentType = "application/x-www-form-urlencoded";
  req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
  req.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.2; zh-CN; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8";

  res = (HttpWebResponse)req.GetResponse();
  StreamReader reader = new StreamReader(res.GetResponseStream(), System.Text.Encoding.Default);

  strResult = reader.ReadToEnd();

慕婉清6462132
浏览 1078回答 4
4回答

HUH函数

url值有错,估计是个目录的值,   403是直接访问目录才会有的错误提示

ABOUTYOU

up 应该是你URL不对。 这位兄台也做爬虫技术嘛?

手掌心

403是服务器被拒绝
打开App,查看更多内容
随时随地看视频慕课网APP