I have a self hosted WCF Rest service that I am using to simulate a service that I do not have access to yet. (See JSON REST Service: Content-Encoding: gzip) I gziped my response, but have not found a way to set the Content-Encoding within the HTTP response header. Is there a way to get to the HTTP header object so I can set this field?
you can access the response headers in your service method via the current WebOperationContext:
var response = WebOperationContext.Current.OutgoingResponse;
response.Headers.Add("Content-Encoding", "gzip");
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