HttpClient StatusDescription missing

I am using httpclient from Microsoft.Net.Http (version 2.2.22) to request some of my mvc pages. My page returns an HttpStatusCodeResult, for example:

 return new HttpStatusCodeResult(clientResponse.StatusCode, "Blub Blub");

Using httpclient is no problem invoking the page. But I could not find a way to access the status description ("Blub Blub"). Is there a way to access the description? And if not, why doesn't Microsoft make it available? By the way, if I call the site from a browser (Chrome), the description is displayed as expected.

+4
source share
1 answer

If you use one of the methods from HttpClient, for exampleGetAsync

(https://msdn.microsoft.com/en-us/library/hh158944(v=vs.118).aspx)

HttpResponseMessage

(https://msdn.microsoft.com/en-us/library/system.net.http.httpresponsemessage(v=vs.118).aspx).

ReasonPhrase, , .

+4

Source: https://habr.com/ru/post/1677459/


All Articles