title: How do I correctly use HttpClient with async/await?
body: <p>I'm getting two errors for the following code:</p>
  
  <pre><code>public async Task&lt;string&gt; TestDownloadTask()
  {
      HttpResponseMessage response = null;
  
      using (HttpClient client = new HttpClient())
      {
          client.BaseAddress = new Uri(@"https://api.nasa.gov/planetary/apod");
          client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  
          response.EnsureSuccessStatusCode();
          response = await client.GetStringAsync("?concept_tags=True&amp;api_key=DEMO_KEY");
      }
  
      return response.Content;
  }
  </code></pre>
  
  <p>I'm getting:</p>
  
  <ul>
  <li>Cannot await 'System.Threading.Tasks.Task' on the "await" line</li>
  <li>Cannot convert expression type 'System.Net.Http.Content' to return type 'string'</li>
  </ul>
  
  <p>I've been attempting to write the above code that will download a string from a web service, but there seems to be a lot of conflicting information about how to use async and await and how to use HttpClient and I do not know what is wrong with the code I've written.</p>
  
  <p>Where am I going wrong and how should I be doing it instead?</p>