I'm working on an ASP.NET project, and I'm having trouble getting session variables to work across the entire project. Specifically, I'm saving a value to the session like this:
Session["ConsumerId"] = lobjlogin.ConsumerId;
However, when I try to access this session variable in different parts of the project, it's not working as expected.


Amit MohantyRank #112 · 20K reputationPosted Jul 12, 2024, 9:28 AM EDT
Please verify that cookies are enabled in your browser because session state relies on cookies. Also, ensure you are not accidentally clearing or abandoning the session, such as avoiding calls to Session.Abandon() or Session.Clear().
Amit MohantyRank #112 · 20K reputationPosted Jul 12, 2024, 7:51 AM EDT
Make sure that the session state is enabled in your web.config file:
Ishika TiwariRank #298 · 8.4K reputationPosted Jul 12, 2024, 9:04 AM EDT
i already did it but it's not working