We can set our custom session timeout
in our applications by following Methods
1.
In Web.config file
we can set session timeout like as shown below
<configuration>
<system.web>
<sessionState mode="InProc" timeout="120">
</sessionState>
</system.web>
</configuration>
|
Note that if you are using Forms
authentication, the Forms timeout setting will log the user out after the set
timeout period so you will also have to adjust this attribute:
<authentication mode="Forms" >
<forms timeout="120">
</authentication>
|
2.
In
Global.asax file we can set session timeout in Session_Start event
like this
void Session_Start(object sender, EventArgs
e)
{
// Code that runs when a new session is started
Session.Timeout = 120;
}
|
3.
In IIS
setting you can also set default session timeout.
1.
Open
IIS start-->run type-->inetmgr and press enter.
2.
Click
on "Web Site" and click “Session State” in right
Pane.
3.
Once
open Session State set timeout in under cookie settings section like as shown
below
Set
idle timeout:
1.
Open
IIS start-->run type-->inetmgr and press enter.
2.
Click
on "Application Pool" and select “Advance Settings”
3. Increase the idle
timeout according to screenshot.
No comments:
Post a Comment