School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
Welcome to Dream.In.Code
Become an Expert!

Join 340,150 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 3,875 people online right now. Registration is fast and FREE... Join Now!



Logging into a website

Page 1 of 1

Logging into a website Rate Topic: -----

#1 dreadfear  Icon User is offline

  • D.I.C Head
  • PipPip
  • Group: Members
  • Posts: 166
  • Joined: 08-December 08


Dream Kudos: 0

Post icon  Posted 08 January 2009 - 05:09 AM

Im trying to login to my website with vb.net (without the use of java script).

webbrowser.documents.forms(0).submit


All i can find on the internet is to use that there to click the login button but it doesn't work.

I also found this for filling in the login forms but im having trouble understanding how it works.

	  Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
			  WebBrowser1.document.All("txtUser").SetAttribute("value", "myusername")
			  WebBrowser1.document.All("txtPassword").SetAttribute("value", "mypassword")
			  WebBrowser1.document.All("btnSubmit").InvokeMember("click")
		  End Sub 


So if anyone could explain to me how to fill a form or how to click a submit button then that would be greatly appreciated.

NOTE: I can do this in javascript so please dont post javascript.
Was This Post Helpful? 0
  • +
  • -


#2 chrixko  Icon User is online

  • D.I.C Head
  • PipPip
  • Group: Members
  • Posts: 52
  • Joined: 25-November 08


Dream Kudos: 0

Posted 08 January 2009 - 11:44 PM

Hey, try this :

add a webbrowser to you Form

Webbrowser1.Navigate("www.yourhomepage.com/input.php")
'Link just an example

If Webbrowser1.ReadyState = WebBrowserReadyState.Complete
		webBrowser1.document.All("txtUsername").SetAttribute("value", "Username")
		webBrowser1.document.All("txtPassword").SetAttribute("value", "mypass01")
' This fills the controls with your values
' But you need the name of the Control for the parameter ..document.all(name of the control)...

		webBrowser1.document.Forms(0).InvokeMember("submit")
'This calls the submit



This post has been edited by chrixko: 09 January 2009 - 03:14 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month