views:

105

answers:

1

Hi I want to be able to log into a website via C# webbrowser without any user input. I want to get the username and password from local variables.

I hope someone can help me.

Please give clear C# code examples.

A: 

Go to the login-page of the site, expose the <form></form> that does the login, mimic the form with a POST request and encode the username/password in the body of the POST.

To fabricate this, you'll probably have to make a custom request. Linking up the session ID of the Request & the web-browser will probably be tricky, you'd have to set the referral url manually in the next post, and migrate the cookies the server told you to set.


The other solution is to inject some javascript into the login page that populates the fields and hits the submit button.

Either way it's pretty page-specific.

Aren