This is a general question that I'm confused about. I thought once a REST request was made, an error would come back via a WebException
. In one case I have I'm getting a HttpRequestException
, which doesn't allow me to get the HTTP status code.
I'm new to this stuff, but what is the difference between these? Why are there two types? When does one get used as opposed to another?
WebException
seems to work well. HttpRequestException
seems like a very weak version of it, where it knows the status code (in it's message) but it won't tell me explicitly what it was.
EDIT:
I'm using a HttpClient
. Specifically calling client.GetStreamAsync()
.