How to add multiple cookies to Response in WCF / REST service
- by Sumtraveller
I have access to WebOperationContext and can add one cookie by doing this:
WebOperationContext.Current.OutgoingResponse.Headers.Add("Set-Cookie: foo_a=bar_a");
However if I call that several times, e.g.:
WebOperationContext.Current.OutgoingResponse.Headers.Add("Set-Cookie: foo_a=bar_a");
WebOperationContext.Current.OutgoingResponse.Headers.Add("Set-Cookie: foo_b=bar_b");
I should get the following in my header (2 cookies):
Set-Cookie: foo_a=bar_a
Set-Cookie: foo_b=bar_b
But instead get:
Set-Cookie: foo_a=bar_a, foo_b=bar_b
How do I set multiple cookies? Thx