cookie中存储一个信息
比如我们建立一个名为aspxcn,值为刘强的cookie
HttpCookie myCookie = new HttpCookie("aspxcn");
myCookie.Value = "刘强";
Response.AppendCookie(myCookie);
取出这个cookie的方法
HttpCookie mycook = Request.Cookies["aspxcn"];
this.Label1.Text = mycook.Value;
在一个Cookie中储存多个信息比如我们在名为aspxcn的cookie下加多个信息
HttpCookie myCookie = new HttpCookie("aspxcn");
myCookie.Values.Add("color", "blue");
myCookie.Values.Add("music", "love");
Response.AppendCookie(myCookie);
取出信息
HttpCookie mycookie = Request.Cookies["aspxcn"];
string values1 = mycookie["color"];
string values2 = mycookie["music"];