Brockmann: "Creating Rich Web
Applications Gets a Ton Easier"

e-grou chooses Visual WebGui
over standard ASP.NET

Quick migration of VB 6.0
Applications to the Web

Fully functional software versions
for 30 days evaluation period

Download the free edition of the
Visual WebGui Studio
 

Code Snippets

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.

Post Rating

Comments

# hghua
Why not use sessionState element in web.config?
Posted by hghua on Monday, June 01, 2009 12:58 PM
# samsuree
I have tried using the sessionState element in web.config and found it doesnt help me out so i tried the code that i have posted and found working.
Posted by samsuree on Friday, July 10, 2009 1:39 AM

Post Comment

Only registered users may post comments.
Most promising startups
Top 3 most promising startups in 2009
   AJAX Framework | Web Development | Cloud applications | RIA Development | Silverlight Applications | Legacy Migration
The most popular open source Ajax applications framework for enterprises | Sitemap | Terms Of Use | Privacy Statement
Copyright © 2005-2009 Visual WebGui®    Design By: Template World
   
Visual Studio Partners