HLRosenberger
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_Us erName={1} &Login1_Pa ssword={2} &Login1_Lo ginButton= 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?
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_Us
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?
There may be a hidden field in the form.
ASKER
A hidden field that would do what? be fed by the visible username or password?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is the correct answer, and was tested.