I was trying to persist a logged in user as a cookie through a WCF Rest Service. I setup the cookie like follows, through a component that the WCF rest service uses:
var cookie = new HttpCookie("Key");
.
.
cookie.HttpOnly = true;
HttpContext.Current.Response.Cookies.Add(cookie);
But the cookie, when retrieved, later on is null:
HttpContext.Current.Request.Cookies.Get("Key"); //returns null
Is cookie not a good way of doing this for WCF rest services, or is there another way to do it?
EDIT: I should note I'm using the same component for a web site, and it's working great for it.
Thanks.