htht66

以前用Session的时候,总是拿来就用,也没想过先定义再使用,今天就换一种方式。

private void Button1_Click(object sender, System.EventArgs e)
{
System.Web.SessionState.HttpSessionState session = System.Web.HttpContext.Current.Session;//
创建Session
session.Add("test","Test Session");//Session赋值
session.Timeout = 10;//设置会话超时期限,单位为分钟
this.TextBox1.Text = System.Web.HttpContext.Current.Session["test"].ToString();
}

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-10-21
  • 2022-01-25
  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-24
  • 2021-05-12
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案