Session
how to destroy a session in asp.net c#?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Andrew FensterRank #983 · 2K reputationPosted Mar 21, 2011, 8:10 PM EDT
That will kill the Session for the current user. If you're using Forms security, you should then call FormsAuthentication.SignOut(); to sign the user out.
That's all there is to it.
Purushottam RathoreRank #120 · 18.2K reputationPosted Mar 21, 2011, 8:36 PM EDT
{
Session["UserId"] = null;
Session.Abandon();
}