Click here to Skip to main content
14,668,708 members
Rate this:
Please Sign up or sign in to vote.
See more:
how to increase session timeout in asp.net
Posted
Updated 11-Aug-20 23:06pm

Rate this:
Please Sign up or sign in to vote.

Solution 1

   
Rate this:
Please Sign up or sign in to vote.

Solution 2

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
<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>
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 3

see the solved one in following link

session timeout in asp.net[^]
   
Rate this:
Please Sign up or sign in to vote.

Solution 7

You can change in webb.config file here is the example

<?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>
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 9

Put this code on Page_Load,
Session.Timeout = 60   // 60 minutes; MAX is 1440 (if I'm not mistaken)
   
Rate this:
Please Sign up or sign in to vote.

Solution 4

Add This code inside <system.web> in web.config file

<sessionState mode="InProc" cookieless="false" timeout="2000"/>
   
Rate this:
Please Sign up or sign in to vote.

Solution 6

hai
try to use following JavaScript code in master page
<script type="text/javascript">
              var logoutUser = false;
              var timeoutHnd = null;
              var logouTimeInterval = 15 * 60 * 1000; // 15 mins here u can increase session time
              function onuser_activite() {
                  if (logoutUser) {
                      ;
                  }
                  else {
                      ResetLogOutTimer();

                  }
              }
              function OnTimeoutReached() {
                  logoutUser = true;
                  alert("You have been automatically Log Off from the system !");
                  window.location.href = "Logout.aspx";

              }
              function ResetLogOutTimer() {
                  clearTimeout(timeoutHnd);
                  // set new timer
                  timeoutHnd = setTimeout('OnTimeoutReached();', logouTimeInterval);
              }


              document.body.onclick = onuser_activite;
              timeoutHnd = setTimeout('OnTimeoutReached();', logouTimeInterval);
          </script>


var logouTimeInterval = 15 * 60 * 1000; in this line session time is passed as 15 mins
   
Rate this:
Please Sign up or sign in to vote.

Solution 8

<configuration>
<system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <httpRuntime targetFramework="4.0"  />
    <sessionState timeout="20000"></sessionState>
</system.web>
</configuration>
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 10

You can do that in different ways. I have provided 2 ways here.
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):
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100