| 
 | 
 
 
 楼主 |
发表于 2013-4-1 09:31:40
|
显示全部楼层
 
 
 
 //参数类 
            item = new HttpItem() 
            { 
                URL = "http://my.himogo.com/Account/LogOn",//URL     必需项 
                Encoding = "utf-8",//编码格式(utf-8,gb2312,gbk)     可选项 默认类会自动识别 
                Method = "Post",//URL     可选项 默认为Get 
                ContentType = "application/x-www-form-urlencoded",//返回类型    可选项有默认值 
                Postdata = "Email=1264268522@qq.com&Password=qazwsx&RememberMe=false", 
                
 
               
 
                //Postdata = "checkCode=&expireDays=0&next=&password=" 
                //+ URLEncode(textBox2.Text.Trim()) + 
                //"&setcookie=0&source=passport&username=" 
                //+ URLEncode(textBox1.Text.Trim()),//Post数据 使用URLEncode是为了解决中文用户名或者密码的问题    可选项GET时不需要写 
            }; 
            //得到HTML代码 
            HttpResult r = http.GetHtml(item); 
            string html = string.Empty; 
            cookie = r.Cookie; 
 
 
跟踪到HttpHelper 
 using (response = (HttpWebResponse)request.GetResponse()) 
                { 
                    result.Header = response.Headers; 
                    if (response.Cookies != null) 
                    { 
                        result.CookieCollection = response.Cookies; 
                       
                    } 
                    if (response.Headers["set-cookie"] != null) 
                    { 
                        result.Cookie = response.Headers["set-cookie"]; 
                    } 
取不到cookie值 |   
 
 
 
 |