|
Dim Httphelp As New CsharpHttpHelper.HttpHelper
Dim Item As New CsharpHttpHelper.HttpItem
Dim Result As New CsharpHttpHelper.HttpResult
If Button1.Text = "Button1" Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''获取验证码及cookie
With Item
.URL = "https://ecp.sgcc.com.cn/BidUpgrade/validateColorServlet?validateType=login"
.Method = "GET"
.KeepAlive = True
End With
Item.ResultCookieType = CsharpHttpHelper.Enum.ResultCookieType.String
Item.ResultType = CsharpHttpHelper.Enum.ResultType.Byte
Result = Httphelp.GetHtml(Item)
Cookie = Result.Cookie
TextBox1.Text = TextBox1.Text & Cookie & vbCrLf
PictureBox1.Image = Image.FromStream(New IO.MemoryStream(Result.ResultByte))
Button1.Text = "Button2"
Exit Sub
Else
''''''''''''''''''''''''''''''''''''''''''''''''''''''登陆''''''''''''''''''''''''''''''''''''''''''''''''''''''
With Item
.URL = “https://ecp.sgcc.com.cn/BidUpgra ... undefined&CODE=” & TextBox2.Text
.Postdata = "stype=&j_username=w1600282&=%C3%DC%C2%EB&j_password=%7Bsgcc%7D57399c45a5b6fa0f4aa02e874546a8c0&checkCodeText=" & TextBox2.Text
.Method = "post"
.Cookie = cookie
.ContentType = "application/x-www-form-urlencoded"
.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
.KeepAlive = True
.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"
'.IsUpdateCookie = True
.Allowautoredirect = True
End With
Item.ResultCookieType = CsharpHttpHelper.Enum.ResultCookieType.String
Item.ResultType = CsharpHttpHelper.Enum.ResultType.String
Result = Httphelp.GetHtml(Item)
TextBox1.Text = TextBox1.Text & Result.Cookie & vbCrLf
TextBox1.Text = TextBox1.Text & Result.Html & vbCrLf
Button1.Text = "Button1"
Exit Sub
End If
以上原来用易语言写过,cookie获取,postdata内容完全一致
if - else 之间是获取验证码及cookie,else-endif 之间是post信息
现在用vb.net重写就登陆不上了....
麻烦各位给看看,谢了
因为是公司内部网站不方便提供账号测试,不好意思
|
|