5 Replies Latest reply: Apr 3, 2008 9:06 PM by ayuso_15 RSS

    Loging out a user

    ayuso_15 Community Member
      Hi everyone, i have found in my application that when you click on the Logout button it will log you out but if you click on the back button of the browser instead of relocating you to the login.cfm, It will show you all the history in the browser.

      Any ideas of how to get rid of this problem?

      <cfif isDefined('URL.logout')>

      <!--- Ends session --->
      <CFLOCK SCOPE="Session" TYPE="Exclusive" TIMEOUT="10">
      <CFSET StructClear(Session)>
      </CFLOCK>

      <!---Redirects to login--->
      <CFLOCATION url="/mcl_sistema/login.cfm" addtoken="no">

      <cfelse>

        • 1. Re: Loging out a user
          Dan Bracuk Community Member
          Don't cache your pages.
          • 2. Re: Loging out a user
            ayuso_15 Community Member
            Do you have any example? I just want this to happen when the user logs out.

            Thanks
            • 3. Re: Loging out a user
              Newsgroup_User Community Member
              it usually happens because user's browser caches the visited pages. this
              is default browser behaviour.
              you can prevent your pages from being cached by using appropriate meta
              tags and/or cfheader tags. google 'coldfusion prevent page caching' for
              more info.

              Azadi Saryev
              Sabai-dee.com
              http://www.sabai-dee.com/
              • 4. Re: Loging out a user
                Dan Bracuk Community Member
                quote:

                Originally posted by: ayuso_15
                Do you have any example? I just want this to happen when the user logs out.

                Thanks

                In that case, the "don't cache the page" method won't work.

                If you want, you can let them do it. From a security standpoint, they were allowed to see those pages anyway. From a functional standpoint, put something in your application.cfc so that if they submit any forms or select any links while they are not logged in, they get re-directed to your login page.
                • 5. Re: Loging out a user
                  ayuso_15 Community Member
                  I have my application.cfm redirecting to login.cfm but when the user clicks on the back button it will show the last page. If they try to do something then it will redirect them to the login.cfm
                  I am using StructClear(Session) and
                  <CFLOCK SCOPE="Session" TYPE="ReadOnly" TIMEOUT="10">
                  <CFIF Session.LoggedIn>
                  <CFIF CGI.SCRIPT_NAME IS NOT "/mcl_sistema/Login.cfm">
                  </CFIF>
                  <CFELSE>
                  <CFIF (CGI.SCRIPT_NAME IS NOT "/mcl_sistema/login.cfm")
                  AND (CGI.SCRIPT_NAME IS NOT "/mcl_sistema/Verificalogin.cfm")>
                  <CFLOCATION URL="/mcl_sistema/Login.cfm" ADDTOKEN="No">
                  </CFIF>
                  </CFIF>
                  </CFLOCK>