title: Distinguish between HttpClient request failure types
body: <p>I need to write code to handle the 2 distinct types of failures that can arise after issuing an HTTP request using an <code>HttpClient</code> object that comes with .Net Framework 4.5:</p>
  
  <ol>
  <li><p>Connectivity failures, when the server can not be reached due to connection problems - e.g. no connection available, timeout expiration, incorrect network settings etc.</p></li>
  <li><p>Although technically not a failure, the case when the request successfully reaches the server but the server responds with an HTTP error status code (e.g. 404, 400, 409, 500 etc.)</p></li>
  </ol>
  
  <p>It is very important that one failure type is not treated as the other. Which is the correct and reliable way to do this? The <code>EnsureSuccessStatusCode()</code> method seems to help with at least the second case, but the documentation is disappointingly scarce.</p>