MVC4 WebAPI Mind Argument?

According to the HttpResponseMessage MSDN documentation, the reason for the phrase (such as "OK" 200 OK) must be set. The HTTP response allows me to specify a reason phrase:

HttpResponseMessage response = new HttpResponseMessage(System.Net.HttpStatusCode.Conflict); response.ReasonPhrase = "conflict message"; 

However, when I use the client-side response as WebResponse, I do not see my own reason. I expect to find it under StatusDescription. Looking at the original answer with Fiddler, it doesn't seem that the reason for the phrase is being installed on the server.

A helpful employee indicated that with the results of the action (and the results) I could do something similar to:

new HttpStatusCodeResult(System.Net.HttpStatusCode.Conflict, "conflict message");

This seems to be the exact functionality that I do, but I'm not sure how to convince WebAPI to collaborate.

Where am I going wrong?

+8
asp.net-mvc wcf-web-api
source share
1 answer

ReasonPhrase does not work in Cassini. Use IIS Express, not Cassini, and you will find that the answer includes a reason.

+8
source share

All Articles