| 
 | 
 
模拟登陆一个网站时, 
        private HttpResult Login( Dictionary<string, string> dic_data) 
        { 
            HttpHelper http = new HttpHelper(); 
            HttpItem item = new HttpItem() 
            { 
                URL = "******", 
                Method = "POST", 
                UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0", 
                ContentType = "application/x-www-form-urlencoded", 
                Postdata = string.Join("&", dic_data.Select(x => $"{x.Key}={x.Value}")), 
                ResultType = ResultType.String, 
                ResultCookieType = ResultCookieType.CookieContainer, 
            }; 
            HttpResult result = http.GetHtml(item); 
            return result; 
        } 
 
ResultCookieType使用CookieContainer获取到 header里面的["set-cookie"]字符串也存到了CookieCollection 
CookieCollection里主要有一个交auth的cookie 
如下 
auth=0102A021322A28FFD808FEA031DEFB7BFFD8080115310038007500610062006B0071006B0071007A006C006C0034006300350031007500610066003700670000012F00FF30D1E1F4C13726F720D2A6D9A86F9B5C03E973BB; 
这时候使用获取到的CookieCollection 去访问另一个链接,就显示没登录 
  HttpHelper http = new HttpHelper(); 
            HttpItem item = new HttpItem() 
            { 
                URL = url, 
                Method = "GET", 
                CookieCollection = cookie, 
                ResultCookieType = ResultCookieType.CookieCollection, 
            }; 
 
            HttpResult result = http.GetHtml(item); 
            return result; 
 
我用postman直接使用auth访问需要访问的链接就能正确获取信息 
求解释是怎么回事,是我的参数设置有问题吗 
第二次遇到这种问题了 
 |   
 
 
 
 |