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);

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.