I have an ASP.net page. When I am closing the webpage I need to clear the session variables.
How to to handle this I need to maintain the timeout to 20 minutes. If he closes and login for any number of times in the 20 minutes timed out time
Is there any possiblity for clearing the ASP.net session id
You cannot do that.
You do not control the browser of the end-user. The user might close the browser, crash, disconnect from the Internet, have javascript disabled or crashed, etc, etc. Or the user might just enter another url (and after that the user might return to your page by using the back button, and expect to continue his/her session with your site).
The window.onbeforeunload is triggered with every unload of the page. Even if the user browses to another page on your site, so they might need your session again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With