Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
how to increase session timeout in asp.net
Posted 20-Feb-13 20:51pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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

Solution 3

see the solved one in following link
 
session timeout in asp.net[^]
  Permalink  
Rate this: bad
good
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>
  Permalink  
v2
Rate this: bad
good
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>
  Permalink  
v2
Rate this: bad
good
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)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Add This code inside in web.config file
 
 <sessionState mode="InProc" cookieless="false" timeout="2000"/>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

I'm using following steps but No use,
 
1. sessionstate mode="InProc" cookieless="false" timeout="2000" in Web config --- No Use
 
2. Session.Timeout = 525600; in global.asax ---- No Use
 

Give me any Solution to maintain session at long time !
  Permalink  
v2
Rate this: bad
good
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
  Permalink  

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

  Print Answers RSS
0 Dnyaneshwar@Pune 994
1 Sergey Alexandrovich Kryukov 826
2 OriginalGriff 448
3 Tadit Dash 390
4 sanket saxena 323
0 Sergey Alexandrovich Kryukov 11,800
1 OriginalGriff 7,225
2 Peter Leow 5,009
3 Abhinav S 3,893
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web03 | 2.8.140421.2 | Last Updated 17 Feb 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid