title: How to make HttpWebRequest async
body: <p>I have such code:</p>
  
  <pre><code>private async Task&lt;string&gt; Request(url)
      {
          Task&lt;string&gt; task = null;
  
          try
          {
              task = MakeAsyncRequest(url, "text/html");
              return await task;
          }
  
          catch
          {
              return null;
          }            
      } 
  
  private async Task&lt;string&gt; MakeAsyncRequest(string url, string contentType)
      {
          HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
          request.ContentType = contentType;
          request.Method = WebRequestMethods.Http.Get;
          request.Timeout = 20000;
          request.Proxy = null;
          Task&lt;WebResponse&gt; task = Task.Factory.FromAsync(
          request.BeginGetResponse,
          asyncResult =&gt; request.EndGetResponse(asyncResult),
          (object)null);
  
              //issue here:
          return await task.ContinueWith(t =&gt; ReadStreamFromResponse(t.Result));
      }
  
  private string ReadStreamFromResponse(WebResponse response)
      {
          using (Stream responseStream = response.GetResponseStream())
          using (StreamReader sr = new StreamReader(responseStream))
          {
              //Need to return this response 
              string strContent = sr.ReadToEnd();
              return strContent;
          }
      }
  </code></pre>
  
  <p>I am calling <code>Request(url)</code> in <code>foreach</code> loop</p>
  
  <pre><code>foreach(var url in myUrlList)
  {
    string body = Request(method).Result;
  }
  </code></pre>
  
  <p>But for some reason the code getting stacked at <code>return await task.ContinueWith(t =&gt; ReadStreamFromResponse(t.Result));</code> and just freezing.</p>
  
  <p>Is there a better way of doing this or may be some one can explain what is happening? 
  I am not getting any errors just something wrong with the <code>await</code>....</p>