0

enter image description hereIn this example, I assign the session token to [HttpRequestHeader.Authorization].

1 Answers1

0

As far as I know, you can try adding the following code on client-side:

using (MyServ.ServiceClient proxy = new MyServ.ServiceClient())
{
     using (new System.ServiceModel.OperationContextScope(proxy.InnerChannel))
     {
         MessageHeader head = MessageHeader.CreateHeader("Authorization", "http://yournamespace.com/v1", data);
         OperationContext.Current.OutgoingMessageHeaders.Add(head);
     }
}

And add this on server-side:

string  auth = OperationContext.Current.IncomingMessageHeaders.
GetHeader<string>("Authorization", "http://mynamespace.com/v1");

Also the article may help you.

Jiayao
  • 510
  • 3
  • 7