How to terminate old session in .Net web based application RRS feed

  • Question

  • User-1893379617 posted


    I have one web based application and having login screen. Currently Once user logged into the application, then If user copy the URL after login and paste it in different tab the user is still able to access inside application. So here user able to access in both tab as logged-in. My requirement is to terminate first/old session If user logged into second session(which is created new session). User should able to login in one session at a time, not in multiple session and also when user logged into new session, it should prompt warning message to both session as account is used some other place. How to achieve this in Web based VB.Net.

    Saturday, December 12, 2020 5:56 PM

All replies

  • User475983607 posted

    This is a basic state management question.   Every website application developer has to manage state and this feature is no different.

    Save a new GUID in the account management tables when the user logs.  Also save the GUID in a cookie. If the cookie GUID does not match the GUID stored in the user's account then the user has already logged in.  You'll also need a timeout column in the event the user forgets to logout.

    Saturday, December 12, 2020 6:18 PM
  • User-1893379617 posted

    Thank You for your reply.

    Could you please give me some example how to create new GUID and where i can find this account management tables. Are you talking about the logging table where user information saved.

    Sunday, December 13, 2020 4:16 PM
  • User475983607 posted


    Could you please give me some example how to create new GUID

    Guid guid = Guid.NewGuid();



    and where i can find this account management tables.

    You must have user accounts in order for the user to login.  We cannot see your code and you have not shared any relevant information but wherever you store your user accounts is where you'll make the modifications.

    Anyway, this programming problem has been discussed and solved many times.    A basic Google search will reveal many solutions.


    Sunday, December 13, 2020 4:50 PM