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.
http://msdn.microsoft.com/en-us/library/system.net.http.httpresponsemessage(v=vs.110).aspx
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.