huMpty duMpty
huMpty duMpty

Reputation: 14470

What happens to session value after it expires?

I just want to know what will happen to the session after it reach it timeout.

I went through the question about “What happens to cart object when session expires?” but it doesn’t explain much.

Does it completely remove the session object or making it null?

Thanks

Upvotes: 0

Views: 3004

Answers (2)

KV Prajapati
KV Prajapati

Reputation: 94645

In general, only the session state will be removed. i.e. all items that had been stored in the Session will be discarded. However, it depends upon the session-state modes (MSDN article). In some cases the session object might be null (read SO thread).

Upvotes: 1

Magnus
Magnus

Reputation: 46947

When the session timeout occurs the Session_End event in global.asax is raised (except when session is handled by the DB) and the session collection is cleared. (the items are removed) If no other object is holding a reference to a particular object in the session collection the GC will collect it.

Upvotes: 4

Related Questions