private void btnRead_Click(object sender, System.EventArgs e)
  {
   //读取
   TextBox2.Text=Request.Cookies["myName"].Values["firstname"];
  }

  private void btnWrite_Click(object sender, System.EventArgs e)
  {
   
   HttpCookie myCookie=new HttpCookie("myName");
   //设置过期时间为1天
   myCookie.Expires=System.DateTime.Now.AddDays(1);
   //赋值
   myCookie.Values.Add("firstname",TextBox1.Text);
   Response.AppendCookie(myCookie);
  }

相关文章:

  • 2021-08-11
  • 2022-02-06
  • 2021-06-21
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2021-06-26
猜你喜欢
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2021-08-02
  • 2021-12-02
  • 2022-02-22
相关资源
相似解决方案