Microsoft Developer
Microsoft Developer

Reputation: 5459

Deal with session in ASP.NET C#

Suppose if there are multiple sessions on single page and out of them I want to clear values of only one session then how can I achieve this. Will Session.clear() clear all sessions' value or it will create ambiguity because of multiple session?

Upvotes: 2

Views: 423

Answers (2)

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

Session.Clear(); // Remove all keys and values from the session state collection of current user
Session.Remove("SessionName"); //Will remove particular session variable of current user

Upvotes: 2

lnu
lnu

Reputation: 1414

You have only one session for one user at a time. If you clear the session, you only clear the session for the current user visiting the page, not for everybody.

Upvotes: 8

Related Questions