Click here to Skip to main content
15,893,401 members
Please Sign up or sign in to vote.
1.25/5 (4 votes)
See more:
how to increase session timeout in asp.net
Posted
Updated 11-Aug-20 23:06pm

 
Share this answer
 
By default, Session timeouts are set to expire in ASP.NET in 20 minutes. To increase the timeout or expiry you should change the timeout attribute for SessionState in the web.config file
XML
<sessionState  timeout="40" />
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="40"/>
</authentication>
 
Share this answer
 
v2
You can change in webb.config file here is the example

XML
<?xml version="1.0"?>

<configuration>
<system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"  />
    <sessionState timeout="20000"></sessionState>
  </system.web>
<pre></configuration>
 
Share this answer
 
v2
Put this code on Page_Load,
Session.Timeout = 60   // 60 minutes; MAX is 1440 (if I'm not mistaken)
 
Share this answer
 
see the solved one in following link

session timeout in asp.net[^]
 
Share this answer
 
Add This code inside <system.web> in web.config file

<sessionState mode="InProc" cookieless="false" timeout="2000"/>
 
Share this answer
 
XML
<configuration>
<system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <httpRuntime targetFramework="4.0"  />
    <sessionState timeout="20000"></sessionState>
</system.web>
</configuration>
 
Share this answer
 
v2
You can do that in different ways. I have provided 2 ways here.
XML
In web.config
<sessionState timeout = "XX" mode = "InProc">
Default value must be there as 20

Else you can do that from IIS level
On IIS select the website you want to change the default session time out. Click on "Session State". provide the Time-out(in minutes):
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900