Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Preventing back button after loggin out?

Preventing back button after loggin out?

Scheduled Pinned Locked Moved ASP.NET
javascriptquestiontools
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    samerh
    wrote on last edited by
    #1

    Hi all, I have developed an applciation where i have placed a log out link in the master page which redirects to a lout.aspx page where i have placed in the code behind the following code: Session.RemoveAll() Response.Redirect("~/Default.aspx") I am being redirected to the login page but when i press back from the back button in IE7 iam being able to see the last page the user was logged in. How can i prevent that taking into consideration that i dont want to delete the back button in all the web pages, however i need to disable it in the login.aspx page only. P.S. I have tried the JS

    <script language="javascript">history.forward(1);</script>

    in the Login.aspx page. thanks

    H N A A 4 Replies Last reply
    0
    • S samerh

      Hi all, I have developed an applciation where i have placed a log out link in the master page which redirects to a lout.aspx page where i have placed in the code behind the following code: Session.RemoveAll() Response.Redirect("~/Default.aspx") I am being redirected to the login page but when i press back from the back button in IE7 iam being able to see the last page the user was logged in. How can i prevent that taking into consideration that i dont want to delete the back button in all the web pages, however i need to disable it in the login.aspx page only. P.S. I have tried the JS

      <script language="javascript">history.forward(1);</script>

      in the Login.aspx page. thanks

      H Offline
      H Offline
      HemJoshi
      wrote on last edited by
      #2

      just try this .... response.setDateHeader("Expires", 0); response.setHeader("Pragma", "no-cache"); or <script>document.execCommand("ClearAuthenticationCache", false)</script>

      modified on Monday, October 13, 2008 9:43 AM

      1 Reply Last reply
      0
      • S samerh

        Hi all, I have developed an applciation where i have placed a log out link in the master page which redirects to a lout.aspx page where i have placed in the code behind the following code: Session.RemoveAll() Response.Redirect("~/Default.aspx") I am being redirected to the login page but when i press back from the back button in IE7 iam being able to see the last page the user was logged in. How can i prevent that taking into consideration that i dont want to delete the back button in all the web pages, however i need to disable it in the login.aspx page only. P.S. I have tried the JS

        <script language="javascript">history.forward(1);</script>

        in the Login.aspx page. thanks

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        There is no reliable way to stop this. You are seeing a browser cached page when you press back button. If you are sure that all session is removed and user can't proceed without valid session, why you are bothering? You should check the session existence each time page refreshes. So users won't be able to continue using secured data after logging out.

        Navaneeth How to use google | Ask smart questions

        S 1 Reply Last reply
        0
        • S samerh

          Hi all, I have developed an applciation where i have placed a log out link in the master page which redirects to a lout.aspx page where i have placed in the code behind the following code: Session.RemoveAll() Response.Redirect("~/Default.aspx") I am being redirected to the login page but when i press back from the back button in IE7 iam being able to see the last page the user was logged in. How can i prevent that taking into consideration that i dont want to delete the back button in all the web pages, however i need to disable it in the login.aspx page only. P.S. I have tried the JS

          <script language="javascript">history.forward(1);</script>

          in the Login.aspx page. thanks

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          samerh wrote:

          Session.RemoveAll()

          Always Use Session.Abandon() For Logout.

          cheers, Abhijit

          1 Reply Last reply
          0
          • N N a v a n e e t h

            There is no reliable way to stop this. You are seeing a browser cached page when you press back button. If you are sure that all session is removed and user can't proceed without valid session, why you are bothering? You should check the session existence each time page refreshes. So users won't be able to continue using secured data after logging out.

            Navaneeth How to use google | Ask smart questions

            S Offline
            S Offline
            samerh
            wrote on last edited by
            #5

            I am checking if the session is still alive however the page is still displayed when i press back button. But if i refresh the page it will redirect me out again.

            N 1 Reply Last reply
            0
            • S samerh

              I am checking if the session is still alive however the page is still displayed when i press back button. But if i refresh the page it will redirect me out again.

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              samerh wrote:

              But if i refresh the page it will redirect me out again.

              Yeah, this is enough. So no need of nasty JS to block back button. :)

              Navaneeth How to use google | Ask smart questions

              S 1 Reply Last reply
              0
              • N N a v a n e e t h

                samerh wrote:

                But if i refresh the page it will redirect me out again.

                Yeah, this is enough. So no need of nasty JS to block back button. :)

                Navaneeth How to use google | Ask smart questions

                S Offline
                S Offline
                samerh
                wrote on last edited by
                #7

                ok but i am being bale to view the last page details the user was in before log out. Only when i hit refresh i am being redirected.

                1 Reply Last reply
                0
                • S samerh

                  Hi all, I have developed an applciation where i have placed a log out link in the master page which redirects to a lout.aspx page where i have placed in the code behind the following code: Session.RemoveAll() Response.Redirect("~/Default.aspx") I am being redirected to the login page but when i press back from the back button in IE7 iam being able to see the last page the user was logged in. How can i prevent that taking into consideration that i dont want to delete the back button in all the web pages, however i need to disable it in the login.aspx page only. P.S. I have tried the JS

                  <script language="javascript">history.forward(1);</script>

                  in the Login.aspx page. thanks

                  A Offline
                  A Offline
                  Alok Sharma ji
                  wrote on last edited by
                  #8

                  why shouldnt you use xml scripting of page expired,session expires or proper using of session ["value"]=null; session.abandon(); this will help you to prevent your page after logout and also **use this codesnippet in masterpage is usefull in security**. bye

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups