Results 1 to 6 of 6

Thread: Session timeout length

  1. #1

    Thread Starter
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Session timeout length

    I'm trying to make a Session last for 2 hours but just can't seem to make it work.

    i have this code in web.config
    Code:
        <sessionState 
                mode="InProc"
                stateConnectionString="tcpip=127.0.0.1:42424"
                sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
                cookieless="false" 
                timeout="120" 
        />
    and then try and set session.timeout when a session begin ie.
    VB Code:
    1. Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
    2.         ' Fires when the session is started
    3.         Session.Timeout = 120
    4.     End Sub

    If in debug mode i use a breakpoint and check the value of Session.timeout it does indeed equal 120, yet the Session never lasts that long when i test it by leaving it alone, say for 30 mins then i come back to it run a little test that tests session values only to find the session has ended.

    Anyone know any idea why this is happening?
    Is 2 hours just to long to hold Session? if so why is session.timeout an integer (in minutes)?

    Thanks for any help.

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    Open IIS, find your web app & open the Properties window. Click on the Configuration button, and then the Options tab - you should find the option "Session Timeout"

  3. #3

    Thread Starter
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    ahh, so there's a limit set on the server. I've got no access to the server at all. Oh well, least i can tell the boss it isn't my fault.

  4. #4

    Thread Starter
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    Just got off the phone to the hosts and their support department (though i don't trust them) say that the value for Session timeout thats set in the IIS application configuration is just a default that should be over written by my web.config. Yet this clearly isn't happening. Are they just talking rubbish?

  5. #5
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    They seem to be correct - http://support.softartisans.com/kbview.aspx?ID=676.
    A quick test you could do is to get the session timeout in IIS set to 1 minute, and leave web.config at 20. Leave the app for a minute or two & see if the session has expired.

  6. #6

    Thread Starter
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    Seem to have gotten to the bottom of my problem now though i don't understand how this happens.

    Setting session timeout to 120 minutes in web.config is keeping a user authenticated for 2 hours (because of cookies?) but i don't seem to be able to overule the host servers session timeout of 20 mins which meant the user wasn't getting kicked off the site but was trying to use session variables that didn't exist anymore which was causing the app to crash.

    Axion, thanks for your help but i couldn't find anything in that link.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width