Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, August 23, 2010 11:41 AM
hi ,
How to set session timeout and clear session in web.config and login.aspx ? And when we close the web application , the session must be cleared ?
I have use session.abandon as per below but is not working . Pls advise .
protected void btnLogout_Click(object sender, EventArgs e)
{
Session.RemoveAll();
Session.Abandon();
Response.Redirect("LoginPage.aspx");
}
All replies (3)
Monday, August 23, 2010 2:14 PM ✅Answered
Session.RemoveAll();
Session.Abandon();
Above code should clear session.
And when we close the web application , the session must be cleared ?
Here is a way of doing it..
http://weblogs.asp.net/kodali/archive/2010/04/29/asp-net-session-on-browser-close.aspx
But there is no reliable way of detecting browser close event.
Monday, August 23, 2010 2:31 PM ✅Answered
Session.RemoveAll()
Session.Abandon()
It worked fine for me, Try to debug and see whether your application is hitting the above code when you click logout.
Tuesday, August 24, 2010 5:07 AM ✅Answered
Session.Abandon() always works fine and there is no issue with that. Can you share why you are saying that session.abandon is not working.
If you want to disable back button of browser, then see this post:-
http://zeeshanumardotnet.blogspot.com/2010/06/how-do-disable-back-button-in-browser.html