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.
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.
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.
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).
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With