cookie(C#)用法

protected void Button1_Click(object sender, EventArgs e)
{
HttpCookie cookie = new HttpCookie("name", TextBox1.Text);
cookie.Expires = DateTime.Now + new TimeSpan(0, 0, 5, 0);
Response.Cookies.Add(cookie);

}
protected void Page_Load(object sender, EventArgs e)
{
HttpCookie co
= Request.Cookies["cookie"];
Label1.Text
= co.Value;
}

你可能感兴趣的:(cookie)