Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. byte[] data = Encoding.ASCII.GetBytes($"Identifier={"anyUsername"}&Password={"Password"}");
  2. WebRequest request = WebRequest.Create("http://users.tclnet.ir/Authentication/LogOn");
  3. request.Method = "POST";
  4. request.ContentType = "application/x-www-form-urlencoded";
  5. request.ContentLength = data.Length;
  6. using (Stream stream = request.GetRequestStream())
  7. {
  8. stream.Write(data, 0, data.Length);
  9. }
  10. string responseContent = null;
  11. using (WebResponse response = request.GetResponse())
  12. {
  13. using (Stream stream = response.GetResponseStream())
  14. {
  15. using (StreamReader sr99 = new StreamReader(stream))
  16. {
  17. responseContent = sr99.ReadToEnd();
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement