本帖最后由 liu8359 于 2020-10-2 08:58 编辑
试了好几种办法都不行
[C#] 纯文本查看 复制代码
HtmlWeb web = new HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = web.Load(url);
string code = doc.ParsedText;
[C#] 纯文本查看 复制代码
WebRequest request = WebRequest.Create(url);
WebResponse response = request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("gb2312"));
string code = reader.ReadToEnd();
[C#] 纯文本查看 复制代码
string Html = string.Empty;//初始化新的webRequst
HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(url);
Request.KeepAlive = true;
Request.ProtocolVersion = HttpVersion.Version11;
Request.Method = "GET";
Request.Accept = "*/* ";
Request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5";
Request.Referer = url;
|