How to clear out session on log out How to clear out session on log out asp.net asp.net

How to clear out session on log out


I use following to clear session and clear aspnet_sessionID:

HttpContext.Current.Session.Clear();HttpContext.Current.Session.Abandon();HttpContext.Current.Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", ""));


I would prefer Session.Abandon()

Session.Clear() will not cause End to fire and further requests from the client will not raise the Session Start event.