Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void SubmitData()
- {
- try
- {
- string user = textBox1.Text;
- string pass = textBox2.Text;
- ASCIIEncoding encoding = new ASCIIEncoding();
- string postData = "data%5BUser%5D%5Buserid%5D=" + user + "&data%5BUser%5D%5Bpassword%5D=" + pass + "&submit=Sign+in";
- byte[] data = encoding.GetBytes(postData);
- WebRequest request = WebRequest.Create("https://vpn.hidemyass.com/vpncontrol/signin");
- request.Method = "POST";
- request.ContentType = "application/x-www-form-urlencoded";
- request.ContentLength = data.Length;
- Stream stream = request.GetRequestStream();
- stream.Write(data, 0, data.Length);
- stream.Close();
- WebResponse response = request.GetResponse();
- stream = response.GetResponseStream();
- StreamReader sr = new StreamReader(stream);
- string final_reponse = sr.ReadToEnd();
- Regex r = new Regex(@"Invalid login or password!");
- Match m = r.Match(final_reponse);
- MessageBox.Show(m.Value);
- sr.Close();
- stream.Close();
- }
- catch (Exception ex)
- {
- MessageBox.Show("Error: " + ex.Message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement