Cookie

创建Cookie:

HttpCookie myCookie = new HttpCookie("Cookie1", "deng");
Response.Cookies.Add(myCookie);

接收Cookie: 

txtCookieValues.Text = Request.Cookies["Cookie1"].Value;

编辑Cookie:

Request.Cookies["Cookie1"].Value = Request.Cookies["Cookie1"].Value+txtCookieValues.Text;
Response.Cookies.Add(Request.Cookies["Cookie1"]);

删除Cookie:

Request.Cookies["Cookie1"].Expires = DateTime.Now.AddSeconds(-1);
Response.Cookies.Add(Request.Cookies["Cookie1"]);

 

posted @ 2013-09-15 22:56  d_ai  阅读(135)  评论(0编辑  收藏  举报