title: asp.net HttpClient throws exception on 400 errors when sending synchronous requests
body: <p>The following code for me is throwing an exception when I get a 400 error.  Thus I'm never able to get return response as the exception is always caught.</p>
  
  <pre><code>using (var client = new HttpClient())
  {
      try
      {
          var data = "...";
  
          var RequestBody = JsonConvert.SerializeObject(data);
  
          var requestUri = new Uri("url to error");
          var content = new StringContent(RequestBody, Encoding.UTF8, "application/json");
  
          var response = client.PostAsync(requestUri, content).Result;
          if (!response.IsSuccessStatusCode)  // it never gets in here since an exception is thrown
          {
              throw new HttpException(500, "PhantomJS status request failed");
          }
      }
      catch (Exception ex)
      {
          throw new Exception("PhantomJS status request failed", ex);
      }
  }
  </code></pre>