Auto Logout when user idle
samsuree posted on May 11, 2009 :: 1180 views
The below code will logout the loggedin user when idle for the time specified
Follow the below steps:
1. Declare a variable in web.config file to store the Auto Logout time. (Can use the convenient way to store the time value)
<appSettings>
<!-- Session Time out value is in minutes and could be changed to any desired value-->
<add key ="sessionTimeout" value ="10"/>
</appSettings>
2. In the logon form use the below code
this.Context.HttpContext.Session.Timeout = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["sessionTimeout"]);
This will logout the user when idle for 10 minutes.