locked
Session time out when using Application variable (no session state used) RRS feed

  • Question

  • User-8554525 posted

    I have created an web application in which i use application variable for maintaining the session state. I am not using SESSION state at all.  I have commented all code that can possibly exist in the code (locations like web.config, Global.asax, asp.net pages). But still the application gets timed out at 20 minutes.

    I even tried enabling false in session state of IIS 7.0. Still no luck

    I even increased the default time out from 20 minutes more, still no luck. 

    • ASP.Net 3.5
    • C#
    • VS 2008
    • SQL Server 2005
    • Application Variable
    • No Session state
    • IIS 7 for builds
    • Server 2003 for server builds (XP for development)

    Please help me identify the issues.

     

    Thursday, June 9, 2011 5:57 AM

All replies

  • User197322208 posted

    I have created an web application in which i use application variable for maintaining the session state

    Code, please?

    Thursday, June 9, 2011 8:05 AM
  • User-1359474226 posted

    How did you verify that session is timed out if you are not using Session variable. Session is only relevant if your application uses Session. When the web server encounters the first session variable it keeps the duration for time out specified in the web.config.

    Please share your code

    Thursday, June 9, 2011 8:24 AM
  • User1748172483 posted

    http://www.simon.kaulius.com/page_timeout_in_asp_net.htm

    Please try this.

    Thursday, June 9, 2011 8:44 AM
  • User1748172483 posted

    Probably has nothing to do with the session but with where the session is stored. By default session is stored in same process (InProc) as application is thus whenever the application pool restarts session is lost. To workaround it you can either save the session state on SQL server or OutOfProc mode which allows you to run separate process on Windows which will only store sessions and will be never recycled without the timeout limits are met.

    Thursday, June 9, 2011 8:51 AM
  • User-8554525 posted

    How did you verify that session is timed out if you are not using Session variable

    After 20 minutes of idle state, when i click on something in the page, I am taken to login screen!!!

    Thursday, June 9, 2011 9:00 AM
  • User-1359474226 posted

    This could be your cookie timeout happening, if you are using form authentication. On session time out the application won't redirect to a login page unless and until you check in your code some thing like

    if session[somevalue] == null then

    redirect to login page.

    But in your case you are not using session variable at all, so I was wondering where you are redirecting.

    Thursday, June 9, 2011 9:07 AM
  • User-8554525 posted

    This could be your cookie timeout happening, if you are using form authentication.

    This could be the issue. I am checking. If this solves this issue my one year pending issue will be solved...

    Thursday, June 9, 2011 1:17 PM
  • User-481631678 posted

    If you are not using Session then does Timeout really matters to you? Timeout only wipes the variables stored in Session and even if they are deleted after timeout you are not using Session so it should not matter to you.

    Actaully the default value for Session timeout is 20 mins. For details see this:-

    http://zeeshanumardotnet.blogspot.com/2009/01/why-dot-net-sessions-are-cleared-before.html

    Friday, June 10, 2011 1:09 AM
  • User-8554525 posted

    If you are not using Session then does Timeout really matters to you?

    It really matters a lot since users are getting transferred to the login page. There is not data loss, but makes the application look bad and users feel wierd!!!

    Friday, June 10, 2011 6:37 AM
  • User-29804325 posted

    Hi,

    As it mentioned, if you are not using session in your application. The session timeout will not matter you.  I wonder that what the login mechanism you have to authenticate users? If you use Form authentication, check the cookie timeout and timeout property in Forms section.

    Aslo a quick think, does your host use web farm and user's request will be made on different servers? If it is, also define the MachineKey in configuration file to guarantee the Forms authentication ticket's encryption and decryption are consistent. If not, please confirm your code to see there's any Response.Redirect code in page that cause user redirection(such as in page_load or BasePage class).

    Hope this can help you.

    Monday, June 13, 2011 10:56 PM
  • User-481631678 posted

    If you are not using Session then does Timeout really matters to you?

    It really matters a lot since users are getting transferred to the login page. There is not data loss, but makes the application look bad and users feel wierd!!!

    This means that you are using session for login and authentication purpose. For details how to abvoid abnormal session time out check out this post:-


    http://zeeshanumardotnet.blogspot.com/2009/07/why-sessions-are-terminatedloss.html

    Tuesday, June 14, 2011 4:00 AM