Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#2.0 ASP.NET
I've a .net application which is hosted. Locally i dont have any issues. But in online hosted website is getting timeout session after 5 mins. I checked the whole website. But no where else its not available. How can i resolve this issue?
Posted 21-Jun-13 3:19am
Ruggers673
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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>
Redirecting user to login page after session timeout is similar to refreshing the page after certain intervals method. Only thing which will differ is that calculating time after which the page has to be redirected. Hence time can be calculated using Session.timeout property which will give us session timeout value for that session. Add some grace timings to that value and redirect the user to the login page automatically.
 
Using Window.setTimeout method
In the page Load event:
body.Attributes.Add("onLoad", "window.setTimeout(""window.location.href='login.aspx'""," & (Session.Timeout * 60 * 1000) + 10000 & ");")
 
Using Meta Tag - Refresh
Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout * 60) + 10) & "; URL=Login.aspx")
Both these methods will redirect the user to login page after session timeout + 10 seconds. This is how you can redirect the user to login page after session timeout without user interaction.
 
Also refer some CP articles for more details:
Session management options in ASP.NET[^]
Session Management in ASP.NET[^]
 
To configure Session Time Out on IIS refer the thread provided by Kishore Sharma in Solution 1.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If you have checked everything in your application and no where you are setting session out
then you need to check with IIS setting for session out.
Check here
Session out setting in IIS
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Similar type of problem is discussed on below thread.
how can i increase Session time out for 12 hour in asp 2.0[^]
 
Apart from that you will get some good information about session timeout on below links.
Why Session.Timeout is not working for your website[^]
Session timeout not working properly[^]
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 230
1 PIEBALDconsult 150
2 DamithSL 125
3 Andreas Gieriet 90
4 Jochen Arndt 90
0 OriginalGriff 5,790
1 DamithSL 4,601
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,195


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 21 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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