在Asp.net 中Cookie的用法
在Asp.net 中Cookie的用法
protected void Page_Load(object sender, EventArgs e)
{
HttpCookie cookie = new HttpCookie("aspcn");//声明
Response.AppendCookie(cookie);
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Cookies["aspcn"].Value = "bbnnnndddddn";//赋值
}
protected void Button2_Click(object sender, EventArgs e)
{
this.TextBox2.Text = Request.Cookies["aspcn"].Value;//取值
}