//******
// Determine whether the cookie exists
If (Request. Cookies ["remrember"]! = Null & Request. Cookies ["remrember"] ["userName"]! = Null)
{
}
//******
//******
// Solution for sharing sessions with multiple sites
Response. Cookies ["remrember"] ["userName"] = Session ["UserId"]. ToString ();
Response. Cookies ["remrember"]. Domain = "8bao.com"; // key
Response. Cookies ["remrember"]. Expires = DateTime. Now. AddDays (1); // do not ignore
//******
Generated cookie (IE => Tools => internet Options => General => Settings => View files ):
Cookie name: Cookie: administrator@8bao.com/
Cookie content: remrember userName = xiaodi 8bao.com/1536 1765652096 29704949 1759498592 29704748 *
//******
// Delete the cookie of the shared Session
HttpCookie cookie = Request. Cookies ["remrember"];
Cookie. Expires = DateTime. Today. AddDays (-10 );
Cookie. Domain = "8bao.com"; // key
Response. Cookies. Add (cookie );
//******
Cookie deletion supplement:
Delete a Cookie (that is, the Cookie is physically deleted from the user's hard disk ). You cannot delete a Cookie because it is on your computer. However, you can have the browser Delete the Cookie for you. Set its validity period to a previous date. When the browser checks the Cookie validity period, the expired Cookie is deleted.
References:
Http://www.15seconds.com/issue/971108.htm