siteA.com calls sitecookie.com/cookies.ashx and sets a cookie "cookiename" for sitecookie.com domain. Same browser, same window, new tab, siteB.com calls sitecookie.com/cookies.ashx and tries to get the same cookie "cookiename" (again for sitecookie.com domain) but is null.
cookies.ashx implements IHttpHandler, IReadOnlySessionState and conformsTo [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
So the question is, why is it null and can we retrieve it?
This is how i make requests from siteA and siteB:
WebClient fs = new WebClient();
var data = fs.DownloadData("http://sitecookie.com/cookies.ashx");
var tostring = System.Text.Encoding.ASCII.GetString(data);
return tostring;
This is how i read cookie in cookies.ashx the return value is a string.
var cookie = context.Request.Cookies["cookiename"];
if (cookie != null) return cookie.Value;
return "false";
This is how i write cookie in cookies.ashx
HttpCookie cookie = new HttpCookie("sso");
cookie.Value = context.Request.QueryString["token"];
cookie.Expires = DateTime.Now.AddDays(1);
context.Response.AppendCookie(cookie);
return "true";