Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Passing passwords to Web site

Reply
 
Old 05-22-2008   #1 (permalink)
Laurie Comerford


 
 

Passing passwords to Web site

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

My System SpecsSystem Spec
Old 05-23-2008   #2 (permalink)
John Bundy


 
 

RE: Passing passwords to Web site

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
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Laurie Comerford" wrote:
Quote:

> 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
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Just passing along some information Vista mail
Passing a connection through. Network & Sharing
Site forum site vista tutorials do not play General Discussion
passing whole objects PowerShell
NTLM Passwords Linux NAS passwords Vista networking & sharing


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46