http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 4540|回复: 4

[学生提问] POST成功,但页面还是没登录请求帮助

[复制链接]
发表于 2014-9-27 00:05:11 | 显示全部楼层 |阅读模式
1金钱
请教各位个问题,我这里POST已经登录成功了,但是页面还是未登录状态,拿里出错了,谢谢!




private void 登录按钮_Click(object sender, EventArgs e)
        {
            string 用户名 = 用户名文本框.Text;
            string 密码 = 密码文本框.Text;
            HttpHelper http = new HttpHelper(); //实例化一个类。

            //创建httphelper参数对象
            HttpItem item = new HttpItem()//
            {         

                URL = "http://www.sufeinet.com/member.php?mod=logging&action=login&loginsubmit=yes&frommessage&loginhash=LaPCZ&inajax=1",
                Postdata="formhash=33172b85&referer=http%3A%2F%2Fwww.sufeinet.com%2Fhome.php%3Fmod%3Dspacecp&loginfield=username&username=xzaill&password=xzaill&questionid=0&answer=",
                //Postdata = "fastloginfield=username&username=" + 用户名 + "&password=" + 密码 + "&quickforward=yes&handlekey=ls",
                Method = "post",//URL     可选项 默认为Get   
                //ContentType = "text/html",//返回类型    可选项有默认值   
                ContentType = "application/x-www-form-urlencoded",//返回类型    可选项有默认值   
            };
            //请求的返回值对象
            HttpResult result = http.GetHtml(item);
            //获取请求的html
            string html = result.Html;
            //获取请求的cookie
            string cookie = result.Cookie;

            textBox1.Text = html;
            if (html.Contains("欢迎您回来"))
            {
                游览器1.Document.Cookie = cookie;
                游览器1.Navigate("http://www.sufeinet.com");
                游览器1.Refresh();  //这3行怎样改都不行

                MessageBox.Show("登录成功");
            }
            else {
                MessageBox.Show("登录失败");
            }

        }



1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
发表于 2014-9-27 00:21:08 | 显示全部楼层
这样是不会通用的要用api写入,可以搜索一下,我记得以前有人发过帖子
回复

使用道具 举报

 楼主| 发表于 2014-10-7 00:03:33 | 显示全部楼层
POST登录是成功了,游览器控件还是未登录状态!
这是COOKIE api不知道如何操作!还请苏飞指点一下我这刚开始学习C#的,
rZmA_05a9_saltkey=iv8421gC; expires=Wed, 05-Nov-2014 15:17:50 GMT; path=/;

domain=.sufeinet.com; httponly,

rZmA_05a9_lastvisit=1412605070; expires=Wed, 05-Nov-2014 15:17:50 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_sid=O7SwIl; expires=Tue, 07-Oct-2014 15:17:50 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_lastact=1412608670%09member.php%09logging; expires=Tue, 07-Oct-2014

15:17:50 GMT; path=/; domain=.sufeinet.com,

rZmA_05a9_ulastactivity=373bzx0mmCyblsPdbwpxnsroM5dmHuY71DGmD%2FBJ9W7FhsKWV17D;

expires=Tue, 06-Oct-2015 15:17:50 GMT; path=/; domain=.sufeinet.com,

rZmA_05a9_sid=O7SwIl; expires=Tue, 07-Oct-2014 15:17:50 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_auth=a964CNIbcthM7mPYNBd2k354u8QtLX9nIkmd0mXxYmdnBzTPkBV2QbJMqz4%

2BuK2uXxI67DuLx4J70TiViH9tFgXu%2Fw; path=/; domain=.sufeinet.com; httponly,

rZmA_05a9_loginuser=deleted; expires=Sun, 06-Oct-2013 15:17:49 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_activationauth=deleted; expires=Sun, 06-Oct-2013 15:17:49 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_pmnum=deleted; expires=Sun, 06-Oct-2013 15:17:49 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_lastcheckfeed=24657%7C1412608670; expires=Tue, 06-Oct-2015 15:17:50

GMT; path=/; domain=.sufeinet.com,

rZmA_05a9_checkfollow=1; expires=Mon, 06-Oct-2014 15:18:20 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_lip=1.197.45.69%2C1412608593; path=/; domain=.sufeinet.com
回复

使用道具 举报

 楼主| 发表于 2014-10-7 11:59:20 | 显示全部楼层
站长苏飞 发表于 2014-9-27 00:21
这样是不会通用的要用api写入,可以搜索一下,我记得以前有人发过帖子

POST登录是成功了,游览器控件还是未登录状态!
这是COOKIE api不知道如何操作!还请苏飞指点一下我这刚开始学习C#的,
rZmA_05a9_saltkey=iv8421gC; expires=Wed, 05-Nov-2014 15:17:50 GMT; path=/;

domain=.sufeinet.com; httponly,

rZmA_05a9_lastvisit=1412605070; expires=Wed, 05-Nov-2014 15:17:50 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_sid=O7SwIl; expires=Tue, 07-Oct-2014 15:17:50 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_lastact=1412608670%09member.php%09logging; expires=Tue, 07-Oct-2014

15:17:50 GMT; path=/; domain=.sufeinet.com,

rZmA_05a9_ulastactivity=373bzx0mmCyblsPdbwpxnsroM5dmHuY71DGmD%2FBJ9W7FhsKWV17D;

expires=Tue, 06-Oct-2015 15:17:50 GMT; path=/; domain=.sufeinet.com,

rZmA_05a9_sid=O7SwIl; expires=Tue, 07-Oct-2014 15:17:50 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_auth=a964CNIbcthM7mPYNBd2k354u8QtLX9nIkmd0mXxYmdnBzTPkBV2QbJMqz4%

2BuK2uXxI67DuLx4J70TiViH9tFgXu%2Fw; path=/; domain=.sufeinet.com; httponly,

rZmA_05a9_loginuser=deleted; expires=Sun, 06-Oct-2013 15:17:49 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_activationauth=deleted; expires=Sun, 06-Oct-2013 15:17:49 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_pmnum=deleted; expires=Sun, 06-Oct-2013 15:17:49 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_lastcheckfeed=24657%7C1412608670; expires=Tue, 06-Oct-2015 15:17:50

GMT; path=/; domain=.sufeinet.com,

rZmA_05a9_checkfollow=1; expires=Mon, 06-Oct-2014 15:18:20 GMT; path=/;

domain=.sufeinet.com,

rZmA_05a9_lip=1.197.45.69%2C1412608593; path=/; domain=.sufeinet.com
回复

使用道具 举报

发表于 2014-10-7 16:24:13 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-4-24 00:17

© 2014-2021

快速回复 返回顶部 返回列表