How to read HTTP request headers in a WCF web service?
Try WebOperationContext.Current.IncomingRequest.Headers
I use following codes to see all headers :
IncomingWebRequestContext request = WebOperationContext.Current.IncomingRequest;
WebHeaderCollection headers = request.Headers;
Console.WriteLine("-------------------------------------------------------");
Console.WriteLine(request.Method + " " + request.UriTemplateMatch.RequestUri.AbsolutePath);
foreach (string headerName in headers.AllKeys)
{
Console.WriteLine(headerName + ": " + headers[headerName]);
}
Console.WriteLine("-------------------------------------------------------");
This is how I read them in one of my Azure WCF web services.
IncomingWebRequestContext woc = WebOperationContext.Current.IncomingRequest;
string applicationheader = woc.Headers["HeaderName"];