Advertisement
Vadorequest

Untitled

Oct 7th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. public static async Task<string> Connect(string email, string password, byte[] data)
  2.         {
  3.             HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri + "user/connect?");
  4.             request.Method = HttpMethod.Post;
  5.             request.ContentType = "application/x-www-form-urlencoded";
  6.  
  7.         // Don't works because GetRequestStream() don't exists...
  8.             //using (var writer = new StreamWriter(request.GetRequestStream()))
  9.             //{
  10.             //    writer.Write("field=value");
  11.             //}
  12.  
  13.             HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();
  14.             using (var sr = new StreamReader(response.GetResponseStream()))
  15.             {
  16. //                Debug.WriteLine(sr.ReadToEnd());
  17.                 return sr.ReadToEnd();
  18.             }
  19.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement