Grabbing an image via GetStreamAsync
, how do I determine status?
HttpClient OpenClient = new HttpClient();
Stream firstImageStream = OpenClient.GetStreamAsync("imageUrl.jpg").Result;
Sometimes this will give an error (403 or 404 typically) and I simply want to skip processing those results.
All I can find says to use the StatusCode
property or IsSuccessStatusCode
, but those seem to only work on HttpResponseMessage
, which is from GetAsync, which does not give me the Stream
I need to process the image.