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();
url值有错,估计是个目录的值,
403是直接访问目录才会有的错误提示
up 应该是你URL不对。
这位兄台也做爬虫技术嘛?
403是服务器被拒绝