everyone
I have two websites www.web1.com and www.web2.com. Now I want to write a cookie in web1 and make it write to web2 by Response.Redirect. If it works I want to implement a simple sso through this approach. However, I can't read the cookie in web2. Could somebody help me to find out whether there's something wrong with my code or cookies can't be shared cross domain by this way. thanks:)
here's the code:
in www.web1.com/Default.aspx
protected void Page_Load(object sender, EventArgs e)
{
HttpCookie ck = new HttpCookie("userid", "00000001");
ck.Expires = DateTime.Now.AddDays(1);
ck.Domain = ".web2.com";
Response.Cookies.Add(ck);
Response.Redirect("http://www.web2.com/Default.aspx");
}
and code in www.web2.com/Default.aspx
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Cookies["userid"] != null)
{
lbCookie.Text = Request.Cookies["userid"].Value;
}
else
{
lbCookie.Text = "No Cookies";
}
}