In case I did it wrong, is there a way to add Session Token that would not produce this error?

37 Views Asked by At

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

1

There are 1 best solutions below

0
Jiayao On

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.