| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 780 人关注过本帖
标题:求教--关于使用httpwebquest自动登陆的问题
只看楼主 加入收藏
iamli
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-5-27
收藏
 问题点数:0 回复次数:0 
求教--关于使用httpwebquest自动登陆的问题
源码如下......返回的结果是登陆的界面...而不是登陆成功后的界面....求教各位高手   
Dim cc As New CookieContainer
        Dim BAIDU_Url As String = "http://passport.baidu.com/?login"
        Dim req As HttpWebRequest = CType(WebRequest.Create(BAIDU_Url), HttpWebRequest)
           req.Referer = https://passport.baidu.com/?login
          req.ContentType = "application/x-www-form-urlencoded"
        req.AllowAutoRedirect = True
        req.Timeout = 20000
        Dim postData() As Byte
        postData = Encoding.GetEncoding("GB2312").GetBytes("tpl_ok=&next_target=&tpl=mn&skip_ok=&aid=&need_pay=&need_coin=&pay_method=&u=http://baidu.com&return_method=get&more_param=&return_type=&psp_tt=0&password=******&safeflg=0&username=********&verifycode=")
        req.ContentLength = postData.Length
        req.CookieContainer = cc

        req.Method = "POST"
        Dim sm As Stream = req.GetRequestStream

        sm.Write(postData, 0, postData.Length)

        Dim strResult As String
        Dim res As HttpWebResponse = CType(req.GetResponse, HttpWebResponse)

        res.Cookies = cc.GetCookies(req.RequestUri)
     
            Dim smRes As Stream = res.GetResponseStream

            Dim sr As New StreamReader(smRes, Encoding.GetEncoding("GB2312"))

            strResult = sr.ReadToEnd()

            res.Close()
            WebBrowser1.DocumentText = strResult
   
搜索更多相关主题的帖子: 登陆 自动 httpwebquest 
2010-05-27 16:36
快速回复:求教--关于使用httpwebquest自动登陆的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.054842 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved