求教--关于使用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