在vb.net如何实现点击按钮自动 post用户名和密码到chklogin页实现自动登陆?
只需post 用户名和密码给验证页以实现登陆不要返回登陆后页面。麻烦帮帮小弟。。。。
[解决办法]
不明白啥意思,就是自动登录? web还是winForm程序?
如果是不要登录界面,直接自动登录的话,可以把用户名密码信息写入注册表,在登录时判断,如果注册表中有值,则读入,自动登录
[解决办法]
WinForm:按钮事件
Try
'发送
Dim sPostData As String = "CardNO=" & txtCardNO.Text.Trim & "&CardPassword=" & txtCardType.Text.Trim
Dim ByteArray As Byte() = System.Text.Encoding.UTF8.GetBytes(sPostData)
Dim hwRequest As HttpWebRequest = WebRequest.Create(New Uri("http://localhost:2458/WebParameter/Default.aspx"))
hwRequest.Method = "POST"
hwRequest.ContentType = "application/x-www-form-urlencoded"
hwRequest.ContentLength = ByteArray.Length
Dim newStream As Stream = hwRequest.GetRequestStream()
newStream.Write(ByteArray, 0, ByteArray.Length)
newStream.Close()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
Web:Page_Load
Dim sCardNO As String = Request.Form("CardNO")
Dim sCardNO As String = Request.Form("CardPassword")
[解决办法]
我晕,不会引用啊。
Imports System.Net
Imports System.IO