ProgrammerAtAIMS
asked on
Asp.net handling closing browser event
Hello,
I am developing an asp web form using vb where i am using session to hold variable on postback.
But as I know sessions use memory on the server and need to be clear when I close my web.
When the user click on an exit button i can handle it and add session. clear() but the problem is if the user close the browser (clicking on the x button or alt+F4 or end process or....) how to handle this?
I am developing an asp web form using vb where i am using session to hold variable on postback.
But as I know sessions use memory on the server and need to be clear when I close my web.
When the user click on an exit button i can handle it and add session. clear() but the problem is if the user close the browser (clicking on the x button or alt+F4 or end process or....) how to handle this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question has been asked before. There is no known way to end the session on just the browser closing. It could be that the user closed the browser or that the computer lost power or the network connection went down at their ISP. None of those events will give you any information that you can use.
You cannot handle the browser close event. If you want to clean something up (related to a user session), do it in the Session_End event handler so that whenever the session ends, it triggers this event handler. Remember though, this event will get triggered only if you have something in the session variables.
ASKER
Thank you both for your comment
ASKER
But If there is a way to handle the browser close it will be nice to know about it since maybe later I will need it (in case I create temporary tables or need to delete something on exit or ...)
Than