If you need them to log out automatically, start with Linus Caldwell's suggestion for setting a timeout for the web.config session. His example shows 30 minutes, so you just change it to 10. The user will not know that they are logged out, although they are actually trying to request some server resource. For this to happen automatically, you can go in several ways. Both of these methods include automatic page refresh after a timeout period. One way is to use a javascript timer. Another is to add an update header to each page.
<script type="text/javascript"> var seconds = 60 * 11;// set timer for 11 minutes (1 minutes after session expires) countdown(); function countdown(){ seconds--; if (seconds <= 0){ window.location.reload(); // force a refresh. }else{ setTimeout('countdown()', 1000); } } </script>
Another way would be your global.asax:
protected void Application_BeginRequest() { Response.Headers.Add("Refresh", Convert.ToString(Session.Timeout * 11)); }
source share