How to autofill a web login page and autosubmit?

  • Thread starter Thread starter Morten Wennevik
  • Start date Start date
M

Morten Wennevik

I have a login.aspx page consisting of a username label and textbox,
password label and textbox and a submit button.

I want to programmatically autofill this and post it back.

I am using the ActiveX IE/Browser object to navigate to the windows page
However, I'm unsure of how to post the info back to the server.

Any suggestions are welcome.
 
Morten,

If you are using the WebBrowser object, then in the Navigate method,
there is a parameter which will take the extra information to post to the
server. It is here that you would set the username and the password to
whatever you would fill in on the label. This would also require you to use
a POST method, as opposed to a GET method (well, depending on the form
anyways).

Also, are you using .NET on the client side? Have you considered using
the HttpWebRequest and HttpWebResponse classes?

Hope this helps.
 
Morten,

If you are using the WebBrowser object, then in the Navigate method,
there is a parameter which will take the extra information to post to the
server. It is here that you would set the username and the password to
whatever you would fill in on the label. This would also require you to
use
a POST method, as opposed to a GET method (well, depending on the form
anyways).

I've tried setting postData =
"__VIEWSTATE=xxx...&Username=myname&Password=mypassword"
xxx... is the viewstate number
but I'm unsure of how to use postData. Also how would I use POST/GET?
The server is using sessionstates so I'm assuming I need to include
viewstate.
Also, are you using .NET on the client side? Have you considered using
the HttpWebRequest and HttpWebResponse classes?

I am using C# in Visual Studio.Net, so... yes :)
I have used WebRequest/Response in a regular web browser app, but I'm not
too familiar with it.
Hope this helps.

Thanks
 
Morten,

I would suggest using the HttpWebRequest and HttpWebResponse classes if
you don't need to display the content that you download. It will give you
more control and better performance.
 
Thanks, I tried using httpwebrequest/httpwebresponse, but I can't seem to
get redirects.
 

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

Back
Top