Joezzx
Joezzx

Reputation: 31

How to pass http header value to WCF rest service operation?

Is there any way to extract http header value and pass it to WCF rest service operation at global extension point, e.g. customized IParameterInspector? Thanks in advance.

Upvotes: 3

Views: 3106

Answers (1)

Thomas C. G. de Vilhena
Thomas C. G. de Vilhena

Reputation: 14595

Through your WCF service WebOperationContext you can access the current request's http headers like the following:

var request = WebOperationContext.Current.IncomingRequest;
string header = request.Headers[HttpRequestHeader.Cookie];

Upvotes: 3

Related Questions