HttpWebRequest rq = (HttpWebRequest)WebRequest.Create(url);
//这个一定要加上,在某些网站没有会发生"远程服务器返回错误: (403) 已禁止。"错误
rq.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; QQWubi 133; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; CIBA; InfoPath.2)";
rq.Method = "GET";
获取网页源码,返回403错误
最新推荐文章于 2024-05-24 16:32:46 发布