what is the difference between session.abandon() and session.clear() ?

 Session.Abandon():

          Session.Abandon() destroys the session
       Abandon will destroy the session completely, meaning that you need to begin a new session before you can store any more values in the session for that user.
 Session.Clear():

Session.Clear() just removes all values

                Clearing the session will not unset the session, it still exists with the same ID for the user but with the values simply cleared.
The Clear method removes all keys and values from the current session. Compare to Abandon method, it doesn’t create the new session, It just make all variables in session to NULL.


Diff B/w Session.Clear() and Session.RemoveAll():

actually there is no difference. Session.RemoveAll() methods internally makes a call to Clear() method only.


0 comments:

Post a Comment