I'm working an application with asp.net, but I have a problem in session..
I searched a lot about how to kill a session when browser closed but it has not any solution.
Thanks for help.

3 Years
Discussion Span
Last Post by faheemsial

You can clear it manually if you know for sure that the browser was closed. How would you know server side that the browser closed?

The session will clear on its own according to the session timeout period. if a user closes their browser and opens it again and accesses your site, a new session is created.


I owe an explanation. I said about Session.Clear() to use it whenever the information stored inside the session variables are not needed any more. In this way you might see that you dont need to worry about the closing of the browser.
@JorgeM is absolutelly corect in all he direct you


but how can I guess the period of session timeout ?
In my application when a user open a page I give him the permission to do something, but when he close the browser I have to clear or remove the session.
But the problem when I close the browser and open again the session doesn't remove.


just a guess but i think it can be done in global.asax Session_End event. do call same statements as suggested by @tdrosiadis ..... it will clear session if user closes browser without log-out or any action.


try it out.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.