I’m trying to use an HTTP method that has defined a private protocol for status code. What can I do if the HttpStatusCode class doesn’t have the necessary value?
The HttpStatusCode enumeration contains predefined constants for the status codes described by the HTTP 1.1 standard. Here you can take advantage of the fact that an enumeration is by default an integer-typed value to make use of your own custom status codes. This probably only makes sense if you’re not using SOAP as the envelope format because SOAP defines an expected set of status codes for the response when using HTTP.
HttpResponseMessageProperty p = new HttpResponseMessageProperty();p.StatusCode = (HttpStatusCode)555;OperationContext.Current.OutgoingMessageProperties[HttpResponseMessageProperty.Name] = p;