你好:
写入方法:
HttpCookie cookie = new HttpCookie("id");
cookie.Value=cookieValue;
cookie.Expires = DateTime.Now+new TimeSpan(0,1,0,0));
Response.Cookies.Add(cookie);
读取方法:
HttpCookie cookie = Request.Cookies["id"];
if(null == cookie)
{
Label1.Text = "";
}
else
{
Label1.Text = cookie.Value;
}
if (Request.Cookies["id"]!=null)
Label1.Text=Request.Cookies["id"].Value;