title: How to get and print response from Httpclient.SendAsync call
body: <p>I'm trying to get a response from a HTTP request but i seem to be unable to. I have tried the following:</p>
  
  <pre><code>public Form1() {     
  
      HttpClient client = new HttpClient();
      client.BaseAddress = new Uri("someUrl");
      string content = "someJsonString";
      HttpRequestMessage sendRequest = new HttpRequestMessage(HttpMethod.Post, client.BaseAddress);
      sendRequest.Content = new StringContent(content,
                                              Encoding.UTF8,
                                              "application/json");
  </code></pre>
  
  <p>Send message with:</p>
  
  <pre><code>    ...
      client.SendAsync(sendRequest).ContinueWith(responseTask =&gt;
      {
          Console.WriteLine("Response: {0}", responseTask.Result);
      });
  } // end public Form1()
  </code></pre>
  
  <p>With this code, i get back the status code and some header info, but i do not get back the response itself. I have tried also: </p>
  
  <pre><code>  HttpResponseMessage response = await client.SendAsync(sendRequest);
  </code></pre>
  
  <p>but I'm then told to create a async method like the following to make it work</p>
  
  <pre><code>private async Task&lt;string&gt; send(HttpClient client, HttpRequestMessage msg)
  {
      HttpResponseMessage response = await client.SendAsync(msg);
      string rep = await response.Content.ReadAsStringAsync();
  }
  </code></pre>
  
  <p>Is this the preferred way to send a 'HttpRequest', obtain and print the response? I'm unsure what method is the right one.</p>