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.
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.