WebBrowser이용한 로그인 연동
*
Public Class Form1

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Hide()
WebBrowser2.Hide()
End Sub

Private Sub WebBrowser1_DocumentCompleted(sender As System.Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
TextBox1.Enabled = True
TextBox2.Enabled = True
Button1.Enabled = True
TextBox1.Focus()
Label3.Text = "Connected, please log in to VNote server"
If WebBrowser1.DocumentText.Contains("log out") Then
Label3.Text = "Logged in to VNote server."
TextBox1.Enabled = False
TextBox2.Enabled = False
Button1.Enabled = False

End If
End Sub

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
If WebBrowser1.DocumentText.Contains("fo_member_login") Then
WebBrowser1.Document.GetElementById("uid").SetAttribute("value", TextBox1.Text)
WebBrowser1.Document.GetElementById("upw").SetAttribute("value", TextBox2.Text)
WebBrowser1.Document.Forms(0).InvokeMember("submit")
TextBox1.Hide()
TextBox2.Hide()
Button1.Hide()
Label1.Hide()
Label2.Hide()
Label3.Hide()
WebBrowser2.Show()
Me.WindowState = FormWindowState.Maximized
WebBrowser2.Navigate("http://www.vnote.kr")

End If
End Sub


End Class

 

vnote.PNG

이 게시물을

댓글'2'
교교
  • 2014.03.06
  • 수정: 2014.03.06 16:23:09

Private Sub Form_Load()
w1.Navigate2 "http://static.nid.naver.com/login.nhn?20091104&url=http%3A%2F%2Fwww.naver.com"
End Sub

//웹브라우저 이름 w1

w1.Document.All.uid.Value = "아이디"
w1.Document.All.upw.Value = "비밀번호"
w1.Document.frmNIDLogin.submit '확인버튼

이 댓글을

VNote
  • 2017.06.24

스크립트 오류 무시

 

       WebBrowser1.ScriptErrorsSuppressed = True

이 댓글을

공유하기

SEARCH

MENU NAVIGATION