当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Session Value becomes null on Page refresh

问题描述:

I am trying to save the value in a session and then on page refresh, I am trying to use that value. But every time, it goes inside the loop .

I am using HttpContext.Current.Session because my class is inheriting from HTMLTable.

if (HttpContext.Current.Session["Id"] == null)

{

HttpContext.Current.Session["Id"] = "2";

}

string a = HttpContext.Current.Session["Id"].ToString(); //I get 2, WORKS HERE

分享给朋友:
您可能感兴趣的文章:
随机阅读: