Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set session timeout more than 20 min.?

I have a problem in my project. There is an admin panel in my website. People can login with a username and password can edit website content. Sometimes a user can take up to 30-40 minutes to enter content, but the session timeout expires after only 20 minutes.

I tried to configure this in the web.config, for example:

<authentication mode="Windows"/>
<sessionState timeout="60" />

and like this:

<system.web>
    <sessionState timeout="60"></sessionState>
</system.web>

and also tried in my form like that:

if (ds.Tables["LOG"].Rows.Count > 0)           
{
    Session["IsLoggedIn"] = "true";        
    Session.Timeout = 60;            
    Response.Redirect("Default.aspx");       
}        
else       
{                
    Label1.Text = "Username/Password is wrong!!";    
}

None of the solutions above worked. I tried each separately and together, but the session still expires after 20 minutes.

like image 565
Mehmet Kaleli Avatar asked Nov 12 '09 22:11

Mehmet Kaleli


People also ask

How do you extend session timeout?

Click Servers > Server Type > WebSphere Application Servers > CongnosX_GW2. Click Container Settings > Session management > Set Timeout. Enter the desired timeout value in minutes. Click OK.

What is the maximum session timeout?

Session. Timeout has no hard-coded limit. Most Web administrators set this property to 8 minutes. It should not be set higher than 20 minutes (except in special cases) because every open session is holding onto memory.

How do you set infinite session timeout?

The Timeout property can be set in the Web. config file for an application using the timeout attribute of the sessionState configuration element, or you can set the Timeout property value directly using application code. The Timeout property cannot be set to a value greater than 525,600 minutes (1 year).

How do I increase session timeout in IIS 10?

Expand the local computer node, expand "Web Sites", right-click the appropriate website, and then click Properties. 3. Click the "Web Site" tab. 4.In the Connections area, change the value in the "Connection timeout" field, and then click OK.


1 Answers

Another hint is to have a look at your IIS settings. When i had to change my timeouts I had to make some server side changes as well. Check the Idle Time-out setting for the application pool. If the site goes idle (i think default of 5 min) then the application pool shuts down to save server resources. This will kill a session as well.

Try increasing the Idle Time-out for the application pool to see if this helps at all.

IIS » Directory » Config » Options AND AppPool » Properties

Obviously if you are in a shared hosting environment you will most likely not be able to adjust this.

like image 89
Webking Avatar answered Nov 15 '22 09:11

Webking