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
[EDIT] As others have suggested, your session should time out eventually, but if you want to close the session before the timeout (for example to clean up large session objects) AND have javascript available to you…
You can do this with an
window.onbeforeunloadhandler that posts back to a sign out page.You could also do it via AJAX. The SignOut.aspx page (or whatever platform you are using) should abandon the user’s session.