C# – How to get the status code when using HttpClient
When you use HttpClient to make requests, you can directly get the status code from the HttpResponseMessage object, like this: The main reason for checking the status code is to determine if the request was successful and then reacting to error status codes (usually by throwing an exception). The HttpResponseMessage class has two helpers that … Read more