Punkbastard

HttpClient Get Request Method - C#

Oct 28th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.41 KB | None | 0 0
  1. async static void GetRequest(string url)
  2. {
  3.     using (HttpClient _client = new HttpClient())
  4.     {
  5.         using (HttpResponseMessage response = await _client.GetAsync(url))
  6.         {
  7.             using (HttpContent content = response.Content)
  8.             {
  9.                 string mycontent = await content.ReadAsStringAsync();
  10.                 Console.WriteLine(mycontent);
  11.             }
  12.         }
  13.  
  14.     }
  15. }
Add Comment
Please, Sign In to add comment