WebClient.DownloadString result is not match with Browser result 2

后端 未结 3 1284
孤街浪徒
孤街浪徒 2021-01-27 03:33

The following code:

WebClient wc = new WebClient();
wc.Encoding = Encoding.UTF8;
string Url = "http://www.tsetmc.com/t         


        
3条回答
  •  心在旅途
    2021-01-27 04:11

    public class WC : WebClient
    {
        protected override WebRequest GetWebRequest(Uri url)
        {
            var request = base.GetWebRequest(url) as HttpWebRequest;
            request.AutomaticDecompression = DecompressionMethods.GZip;
    
            return request;
        }
    }
    

    Usage:

    var url = "http://www.tsetmc.com/tsev2/data/instinfodata.aspx?i=59266699437480384&c=64";
    var wc = new WC();
    wc.Encoding = Encoding.UTF8;
    var result = wc.DownloadString(url);
    

提交回复
热议问题