0

Where are session variables such as...

Session["TestVariable"]

...stored?

I've used them in the past quite a lot - but I don't understand where/how long they are stored for. I'm impressed by how they can be accessed by any page or any class but yet don't understand where they reside.

SkonJeet
  • 4,827
  • 4
  • 23
  • 32
  • possible duplicate of [Session in Asp.net](http://stackoverflow.com/questions/229228/session-in-asp-net) – vcsjones Apr 02 '12 at 15:37
  • @vcsjones - wrong. "When we add a variable to ASP.NET Session, where are those variables actually stored on the client side?" That question is incorrect in itself, mine is not. Mine may be a duplicate, as you say, but not of the question found on the link you provided. – SkonJeet Apr 02 '12 at 15:47
  • The question is more-or-less the same, but if you want a completely identical question, then [look at this one](http://stackoverflow.com/questions/4526349/where-are-the-session-variables-saved) - your question is a subset of that one. My point is that this question has been asked plenty of times before. – vcsjones Apr 02 '12 at 15:51
  • Whether it's more-or-less the same is debatable. Either way, thanks for the links to the other question, I'll have a read now. – SkonJeet Apr 02 '12 at 15:53

2 Answers2

4

It depends on how you have session configured, but if it's normal InProc session it's stored in the memory space of the ASP.NET worker process.

Take a look at this MSDN article on session state for more information.

James Johnson
  • 45,496
  • 8
  • 73
  • 110
-2

It is storied on the server side cache per user, that is why it is available after page reload. You might want to look at this for a better overview.

JustinDoesWork
  • 508
  • 1
  • 5
  • 15