Advertisement
Guest User

Untitled

a guest
Oct 29th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. try
  2. {
  3. textBox3.Clear();
  4. string user = textBox1.Text;
  5. string pass = textBox2.Text;
  6. ASCIIEncoding encoding = new ASCIIEncoding();
  7. string postUser = "user=" + user;
  8. string postPass = "pass=" + pass;
  9. byte[] Binduser = encoding.GetBytes(postUser);
  10. byte[] Bindpass = encoding.GetBytes(postPass);
  11.  
  12.  
  13. WebRequest requestUser = WebRequest.Create("http://xcoreproject.eu/validate-2.php");
  14. requestUser.Method = "POST";
  15. requestUser.ContentType = "application/x-www-form-urlencoded";
  16. requestUser.ContentLength = Binduser.Length;
  17.  
  18. Stream stream = requestUser.GetRequestStream();
  19. stream.Write(Binduser, 0, Binduser.Length);
  20. stream.Close();
  21.  
  22.  
  23. WebResponse response = requestUser.GetResponse();
  24. stream = response.GetResponseStream();
  25.  
  26. StreamReader sr = new StreamReader(stream);
  27. textBox3.Text = sr.ReadToEnd();
  28.  
  29. sr.Close();
  30. stream.Close();
  31.  
  32. WebRequest requestpass = WebRequest.Create("http://xcoreproject.eu/validate-2.php");
  33. requestpass.Method = "POST";
  34. requestpass.ContentType = "application/x-www-form-urlencoded";
  35. requestpass.ContentLength = Bindpass.Length;
  36. Stream streampass = requestpass.GetRequestStream();
  37. streampass.Write(Bindpass, 0, Bindpass.Length);
  38. streampass.Close();
  39. WebResponse responsepass = requestpass.GetResponse();
  40. streampass = responsepass.GetResponseStream();
  41. StreamReader srpass = new StreamReader(streampass);
  42. textBox5.Text = srpass.ReadToEnd();
  43. srpass.Close();
  44. streampass.Close();
  45.  
  46. }
  47.  
  48. catch (Exception ex)
  49. {
  50. MessageBox.Show("Error : " + ex.Message);
  51.  
  52. }
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement