i use the httpclient from Microsoft.Net.Http (version 2.2.22) to request some of my mvc pages. My page returns a HttpStatusCodeResult like:
return new HttpStatusCodeResult(clientResponse.StatusCode, "Blub Blub");
With the httpclient it is not problem to call the page. But i couldn't find a way to access the statusDescription ("Blub Blub"). Is there a way to access the description? And if not, why microsoft doesn't make it accessable? By the way if i call the site from browser (Chrome) the description is shown as expected.
If you use one of the methods from HttpClient
such as GetAsync
(https://msdn.microsoft.com/en-us/library/hh158944(v=vs.118).aspx)
it returns an HttpResponseMessage
object
(https://msdn.microsoft.com/en-us/library/system.net.http.httpresponsemessage(v=vs.118).aspx).
One of the properties of that object is ReasonPhrase
which should contain the description that you sent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With