In ASP.Net, we are having three modes to manage the session:-
1. InProc
2. OutProc or StateServer
3. SQLServer
Where the session to be stored? You can decide on the basis of given definition:-
InProc - In this mode, Session is maintained on the same server machine where your web application is deployed.
OutProc or StateServer - You can maintain the session on another server machine's memory, you can specify the IP address on that system.
SQLServer - You can store session in SQL server tables.
Session timeout can be defined in minutes only. The Timeout property cannot be set to a value greater than 525,600 minutes (1 year). The default value is 20 minutes.
There are two ways to set Session TImeout, one is using web.config file another is using global.asax file.
For example:-
You can write script mentioned below in web.
<configuration>
<system.web>
<sessionState mode="InProc" cookieless="true" timeout="30" />
</system.web>
</configuration>
Other way is to set it in global.asax file.
void Session_Start(object sender, EventArgs e)
{
Session.Timeout = 30;
}
NOTE: IIS 6.0: The minimum allowed value is 1 minute and the maximum is 1440 minutes.
0 Comment(s)