I'm probably missing something obvious here.
I'm using HttpClient which throws HttpRequestException that contains StatusCode in the Message string.
How can I access that StatusCode?
Edit: More info, I wrote this question in rush.
I'm using HttpClient to access another API within my WebApi project. Yes, I know why I'm calling
Status code was passed as part of a string to
HttpRequestException so that you cannot recover it from such exceptions alone.
The design of System.Net.Http requires you to access
HttpResponseMessage.StatusCode instead of waiting for the exception.
If you are now following the Microsoft guide, make sure you understand clearly why it asks you to call
HttpResponseMessage.EnsureSucessStatusCode. If you don't call that function, there should be no exception.