Link to home
Start Free TrialLog in
Avatar of HLRosenberger
HLRosenbergerFlag for United States of America

asked on

login into a WEB page programatically.

I'm logging into a WEB page programatically. Using HttpWebRequest, I am doing the following:

1) download the login WEB page.
2) Parse out the VIEWSTATE.
3) Create and encode post data.
4) POST it by writing to stream.

Here's my post data code:

 postData = String.Format(
                     "__VIEWSTATE={0}&Login1_UserName={1}&Login1_Password={2}&Login1_LoginButton=LOGIN",
                     viewState, username, password)

Now, I read an article about how to send the username and password. Login1_UserName and Login1_Password are the asp IDs of the textboxes for username and password, and Login1_LoginButton is the submit button.   Now upon post, I am getting back a page where there is a read asterisk next to the textboxes for username and password.  So, I must have submitted it correctly, but without the username and password.

Can anyone help me out? How do I send the username and password?
Avatar of Ben McNelly
Ben McNelly
Flag of United States of America image

There may be a hidden field in the form.
Avatar of HLRosenberger

ASKER

A hidden field that would do what?  be fed by the visible username or password?
ASKER CERTIFIED SOLUTION
Avatar of HLRosenberger
HLRosenberger
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is the correct answer, and was tested.