1

I would like to make a vb .net application that auto logs into places and retrieves data from them. I have already succeeded in doing this by opening internet explorer programmably and tabbing to enter name and password. But this is messy, and needs to be well timed. I'm using VB .Net. Is there a way to interface with sites to auto login. Maybe I could inject a cookie, but then the browser could change. Any suggestions would be very helpful. Thanks

Paul Turner
  • 38,949
  • 15
  • 102
  • 166
jmasterx
  • 52,639
  • 96
  • 311
  • 557

6 Answers6

1

May not be something you'd consider, but the ideal tool for you is Selenium rather than reinventing the wheel and writing your own version in VB.net.

Best thing to do is have a quick look at that link, see what you think.

AdaTheDev
  • 142,592
  • 28
  • 206
  • 200
1

Well, it really depends on what authentication scheme the sites use. It is possible to pass a Credentials object with an HttpWebRequest which can be used to authenticate against sites that use basic authentication, windows authentication and similar. But I can't think of a reliable way that would work for any and all sites.

Dan Diplo
  • 25,076
  • 4
  • 67
  • 89
1
'In vb.net...add a webbrowser control. Then use 
webbrowser1.navigate("www.gmail.com")




'Then in the webbrowsers document completed event paste something like this.

'where I wrote "123456" you will put the id of the html element for the username textbox.
'where I wrote "abcdef" you will put the id of the html element for the password textbox.


webbrowser1.Document.GetElementById("123456").InnerText = "yourusernamehere"
webbrowser1.Document.GetElementById("abcdef").InnerText = "yourpasswordhere"
webbrowser1.Document.DomDocument.forms(0).submit()
james
  • 11
  • 1
0

WatiN could be used for some of what you describe but I think almost anything will be messy unless you can find a way to do a silent login where some token is passed along to impersonate someone.

JB King
  • 11,860
  • 4
  • 38
  • 49
0

Is there a way to interface with sites to auto login.

Yes, there is. Well, its just a POST HttpRequest or OAuth token. You can always use direct POST requests with the required headers for any token auth. You can also test these command with cURL from the CLI.

~Without taking VB.net into account~, you can auto login to a website by using:

Autologin via Keypass - http://keepass.info/ or https://www.keepassx.org/

Keypass automatically opens the login URL of the website, fill the login form and submits it.

Select website from your list, then press CTRL+U & CTRL+V - and you are logged in.

Jens A. Koch
  • 39,862
  • 13
  • 113
  • 141
0

And CasperJS and PhantomJS may be a way forward too. Using a headless browser you can identify steps in JavaScript you would like to perform at a Website. Useful for interaction through to scraping.

brumScouse
  • 3,166
  • 1
  • 24
  • 38