Passing passwords to Web site

L

Laurie Comerford

Hi,

I'm using this very simple code to open a web site and it works perfectly.

The site requires that I enter a User Name and password.

I'd like to send those with the application but after making all sorts
of trials to pass the values as parameters - nothing happens.

Can some one guide how to to this - or say it's not possible?


Regards

Laurie

Public Class Form1

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

WebBrowser1.Navigate("http://WebAddress/?disablechatbrowsercheck=0")

End Sub


End Class
 
J

John Bundy

Unless the server setting is turned on allowing you to pass username and
password along with the string (look at the string after you successfully log
in) you will have to do it manually. I say have to, which isn't quite true,
but it is easier.

Look at the source code and find the name of the textbox for each, and the
button name.

I use this sub to set text into textboxes, just pass in the textbox name and
the text you want in it: (wb is the name of my webbrowser)

Sub setText(ByVal _inputName, ByVal _text)
'given an input name and text, the textbox will be populated with
_text
Dim inputs As HtmlElementCollection =
wb.Document.GetElementsByTagName("Input")
Dim input As HtmlElement
For Each input In inputs
If input.Name = _inputName Then
input.InnerText = _text
End If
Next
End Sub

Do that, and then use this sub for clicking a button, just pass in the
button name. Keep in mind this is sometimes case sensitive:

Sub clickButton(ByVal _btnName)
'clicks a button with the supplied name
Dim buttons As HtmlElementCollection =
wb.Document.GetElementsByTagName("input")
Dim button As HtmlElement
For Each button In buttons
If button.Name.Contains(_btnName) Then
button.InvokeMember("Click")
End If
Next
End Sub

Hope that helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top