WebClient client = new() { Encoding = Encoding.GetEncoding("gb2312") }; string html = client.DownloadString(url);改成HttpClient
时间: 2023-02-08 10:56:00 浏览: 101
使用HttpClient获取网页html源代码
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Accept-Charset", "gb2312");
string html = await client.GetStringAsync(url);
阅读全文