6 Replies Latest reply on Feb 13, 2007 4:02 PM by coldfuse228

    Session not timing out...

    coldfuse228
      Hi all, for some reason, my session is not timing out. If I leave my browser and come back the next day, I can still continue working. Can someone tell me why?
      My code
      <cfapplication name="myApp" sessionmanagement="yes" sessiontimeout="#CreateTimeSpan(0,0,30,0)#">

      Thank you so much,
      C
        • 1. Re: Session not timing out...
          Level 7
          <cfapplication name="myApp" sessionmanagement="yes"
          sessiontimeout="#CreateTimeSpan(0,0,30,0)#">

          What are you doing when a session times out? The above code will always
          create a new session whenever it is run and a browser will continue to
          work just fine. What will be gone is any session data previously
          generated before the time out. But if you are automatically
          regenerating this data or somehow handling when it is missing, nothing
          obvious would necessary happen.
          • 2. Re: Session not timing out...
            coldfuse228 Level 1
            Hi Ian, how can I make it so that after 30 minutes if a user tries to hit any page in my site, they would go back to login page to relogin?

            Thanks so much,
            C
            • 3. Re: Session not timing out...
              Level 7
              Hi Ian, how can I make it so that after 30 minutes if a user tries to
              hit any page in my site, they would go back to login page to relogin?

              Thanks so much,
              C

              Check that the session data still exists. This will very depending on
              how exactly you are handling your login state. But since you mention
              session, I will presume you are rolling your own rather then using the
              <cflogin...> some other functionality.

              I would do something like this in my code.

              <cfif NOT StructKeyExists(session, "LoginName")>
              <cflocation url="LoginForm.cfm">
              </cfif>

              Obviously you would set session.LoginName to some value on a successful
              login. Also note that if this check occurs before the LoginForm.cfm
              page you will create an endless loop. There are much more sophisticated
              solutions, but this gives you a bare bones option.
              • 4. Re: Session not timing out...
                coldfuse228 Level 1
                Hi Ian, thanks for your response. I am actually using <cflogin> in my code, but for some reason i could not set session variables inside <cflogin>...</cflogin>

                I will work on your suggestions above,

                Thanks again,
                C
                • 5. Re: Session not timing out...
                  Level 7
                  If you are using the <cflogin> framework, this check is built into that.
                  What ever is between <cflogin> tags will run if the user is not
                  logged onto the system, including after a timeout. Just place the
                  appropriate logic between the tags.
                  • 6. Re: Session not timing out...
                    coldfuse228 Level 1
                    Hi Ian, thank you for your response, I'm a little confused: I have this in application.cfm
                    <cfapplication name="myApp" sessionmanagement="yes"
                    sessiontimeout="#CreateTimeSpan(0,0,30,0)#">
                    ...
                    <cflogin>....code for validation ...</cflogin>

                    With this, my session never seems to expire (seems like user is always logged in). Only after I click logoff (<cflogout>), user will need to relogin. What kind of logic should I put in between the cflogin tags?

                    Thanks so much,
                    C