As Gabriel said, using FormsAuthentication, a timeout will occur behind the scenes, meaning that your user will be prompted to log back in if they access the page after a while.
I would suggest exploring the addition of slideExpiration = "true" to your web.config.
In addition, you may need to automatically disconnect, so potentially sensitive data will not remain open after a timeout.
I did this by calling window.setTimeout (myFunction, 30000) with each page load if the user was authenticated. This function uses jQuery ajax to achieve an action that returns the amount of time remaining before the session expires. Once the amount of time is below zero, you can redirect to the logout action via JavaScript. Otherwise, this method simply calls window.setTimeout (myFunction, 30000) to keep checking.
You can get a fancier by adding a warning message and letting the user click a button that uses jQuery ajax to click on an action that resets the timer.
Mayo
source share