locked
How to set Session time out values RRS feed

  • Question

  • User1435703709 posted

    I deployed ASP.Net 4.0  app on ISS, I wanted to set the session time out value to unlimited or any admisible maximum value. How to achieve that?

    Thursday, April 14, 2011 2:45 AM

Answers

  • User533502567 posted

    I wanted to set the session time out value to unlimited or any admisible maximum value.

    Maximum allowed value of session timeout is 365 days (525,600 minutes).

    How to achieve that?

    As suggested above you can set maximum value for session as 525,600 mins. But you can loose session variables well before that value because of app domain recycle, worker process is restart, app pool recycle etc..(generally those values are way less than "365 days")

    Also there are lot of problems with using such high session timeout value. Session-state variables stay in memory until they are either removed or replaced, and therefore can degrade server performance.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 15, 2011 10:44 AM

All replies

  • User11483486 posted

    This case you have to prevent your session from expiring through some methodologies. there are many methodologies available.

    one of them is here.

    http://www.codeproject.com/KB/session/Reconnect.aspx

     

    Hope that helps.

    Thursday, April 14, 2011 3:43 AM
  • User533502567 posted

    I wanted to set the session time out value to unlimited or any admisible maximum value.

    Maximum allowed value of session timeout is 365 days (525,600 minutes).

    How to achieve that?

    As suggested above you can set maximum value for session as 525,600 mins. But you can loose session variables well before that value because of app domain recycle, worker process is restart, app pool recycle etc..(generally those values are way less than "365 days")

    Also there are lot of problems with using such high session timeout value. Session-state variables stay in memory until they are either removed or replaced, and therefore can degrade server performance.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 15, 2011 10:44 AM
  • User1177242335 posted

    By default it is 20 minutes.

    but u can set max upto 1 year.

    U can do it like this

        <sessionState mode="Custom" timeout="write Minutes in one year here">    
        </sessionState>

     

    Sunday, April 17, 2011 5:53 AM
  • User-519136805 posted

    Why you are looking to set session timeout value more than 1 day. It is not advisable to do so. becoz i degrade the performance of the IIS and website due to heavy load of session data. So i would suggest you not to keep timeout more that 1 day. if you have specific scanerio than please specify here, why you want to do so. becoz normally it is not required.

    Hope this will help !!!

    Monday, April 18, 2011 4:55 AM
  • User-481631678 posted

    Maximum value you can set for session timeout is 365 days, however this is not a practical aproach because your appliaction will restart quite earlier than this limit. Also no user will keep his browser open for 365 days. And if user closes the browser then he can not access his previous session.

    So what I recommend you is set your session timeout to 30-60 mins max. And use aproach mentioned in following link to keep that session alive till user closes the browser:-

    http://zeeshanumardotnet.blogspot.com/2010/11/how-to-keep-session-alive-in-aspnet.html

    Tuesday, April 19, 2011 2:29 AM