title: http client exception handling in asp.net core
body: <p>i am using .net 5 latest prview..Below is the code for  http client in mvc</p>
  <pre><code>var response = await _httpClient.SendAsync(request);
           try
          { 
              response.EnsureSuccessStatusCode();
              data = await response.Content.ReadFromJsonAsync&lt;Abc&gt;();
              return data;
          }
          catch (HttpRequestException ex) when (ex.StatusCode = 404)  ----how to check 404 error?
          {
              throw;
          }
          catch (HttpRequestException ex) when (ex.StatusCode == 503)
          {
              throw;
          }
  </code></pre>
  <p>How to check 404 error or other details in catch.am getting below error.Thanks in advance...</p>
  <p><a href="https://i.stack.imgur.com/4WlZp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4WlZp.png" alt="enter image description here" /></a></p>