What is the difference between Session.Abandon() and Session.Clear() in ASP.Net?
What is the difference between Session.Abandon() and Session.Clear() in ASP.Net?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Session.Abandon()will end the current session.Session_Endwill be fired and the next request will fire theSession_Startevent.Session.Clearwill just clear the session data and the the session will remain alive.Session ID will remain the same in both cases, as long as the browser is not closed.
In a nutshell:
Session.Abandon();cancels the currentSession.Session.Clear();clears all values fromSessionstate.