Im trying to figure what i am doing wrong with this code to login with a certiain username and password. The text box id for the username is username and for the password box the id is password. Im not sure what is wrong here and on top of that the page does have SSL so im not sure how i would have to go about encrypting my data.

string URL = @"https://www.website.com/login/login?";
                    string username = "myusername";
                    string password = "mypassword";
                    string PostDATA = "username=" + username + "&password=" + password;
                    string Source = "";

                    WebClient wc = new WebClient();
                    ASCIIEncoding enc = new ASCIIEncoding();
                    byte[] buffer = enc.GetBytes(PostDATA);
                    byte[] response = wc.UploadData(URL, "POST", buffer);
                    Source = enc.GetString(response);
9 Years
Discussion Span
Last Post by LizR

Um, the problem is you sent your username and password as get data, not post data.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.