Is there a way to prevent session id restore on startup/restart of user's system?

We are using a asp.net app and I am able to login and access the site. For the first time session id is created and stored in cookies.

But if I restart my system without signing out, the session is still alive.
How can I prevent this? from server side.

I can try to delete cookies but it is not practical, as each user will have different preferences.

1 Answer 1


I assume we are talking about a web application over HTTP, which is stateless by nature. I'm not sure this is doable. How would a server know that your client has restarted?

Alternative is to make session time-out really short (1 minute) and refresh it every 30 seconds through AJAX calls.

  • I will try that.
    – user100124
    Aug 21, 2013 at 8:39
  • Yes it's a web app. Also, i came across SystemEvents Class while searching and found i could use sessionending event to detect restart or logoff. Is this possible. msdn.microsoft.com/en-us/library/… Can you tell me if it is the right solution? or is there any cons. We are already using ajax keep alive for short intervel. Kindly suggest.
    – user100124
    Aug 21, 2013 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.