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. How can I avoid back button after logged out

How can I avoid back button after logged out

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netquestion
9 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.
  • B Offline
    B Offline
    BalasubramanianK
    wrote on last edited by
    #1

    I am using Asp.Net 2.0. How can I avoid using back button after logged out from the page. Thanks in adv.

    Balasubramanian K.

    M S A A 4 Replies Last reply
    0
    • B BalasubramanianK

      I am using Asp.Net 2.0. How can I avoid using back button after logged out from the page. Thanks in adv.

      Balasubramanian K.

      M Offline
      M Offline
      m dhu
      wrote on last edited by
      #2

      Check here [Disable back button using javascript]

      A 1 Reply Last reply
      0
      • M m dhu

        Check here [Disable back button using javascript]

        A Offline
        A Offline
        Ankur m
        wrote on last edited by
        #3

        madhukk wrote:

        Disable back button using javascript

        What if the user has disabled javascript? What if user uses Alt+LeftArrowKey?

        ..Go Green..

        1 Reply Last reply
        0
        • B BalasubramanianK

          I am using Asp.Net 2.0. How can I avoid using back button after logged out from the page. Thanks in adv.

          Balasubramanian K.

          S Offline
          S Offline
          Sandeep Mewara
          wrote on last edited by
          #4

          Just search it in CP Q&A forum. This has been asked number of times: one of the ways: Try...In you logout event:

          protected void LogOut()
          {
          Session.Abandon();
          string nextpage = "Logoutt.aspx";
          Response.Write("<script language=javascript>");
          Response.Write("{");
          Response.Write(" var Backlen=history.length;");
          Response.Write(" history.go(-Backlen);");
          Response.Write(" window.location.href='" + nextpage + "'; ");
          Response.Write("}");
          Response.Write("</script>");
          }

          A 1 Reply Last reply
          0
          • B BalasubramanianK

            I am using Asp.Net 2.0. How can I avoid using back button after logged out from the page. Thanks in adv.

            Balasubramanian K.

            A Offline
            A Offline
            Ankur m
            wrote on last edited by
            #5

            This particular question has been asked so many times. I am not able to provide you the codeproject search link for search "disable back". You may try searching. You would get a lot of hits. You may also search Google for "disable back button" if that does not satisfies you. Here are few links from codeproject: http://www.codeproject.com/Questions/73968/Disable-back-option-after-logout.aspx[^] http://www.codeproject.com/Questions/53733/how-to-disable-browser-back-button.aspx[^] Hope this helps!

            ..Go Green..

            modified on Wednesday, June 2, 2010 5:43 AM

            1 Reply Last reply
            0
            • S Sandeep Mewara

              Just search it in CP Q&A forum. This has been asked number of times: one of the ways: Try...In you logout event:

              protected void LogOut()
              {
              Session.Abandon();
              string nextpage = "Logoutt.aspx";
              Response.Write("<script language=javascript>");
              Response.Write("{");
              Response.Write(" var Backlen=history.length;");
              Response.Write(" history.go(-Backlen);");
              Response.Write(" window.location.href='" + nextpage + "'; ");
              Response.Write("}");
              Response.Write("</script>");
              }

              A Offline
              A Offline
              Ankur m
              wrote on last edited by
              #6

              This is the second time today when I was answering a question and as soon as I finished answering, I saw your answer above me. :rolleyes: *I hope you got my previous message in the notification mail.

              ..Go Green..

              S 1 Reply Last reply
              0
              • A Ankur m

                This is the second time today when I was answering a question and as soon as I finished answering, I saw your answer above me. :rolleyes: *I hope you got my previous message in the notification mail.

                ..Go Green..

                S Offline
                S Offline
                Sandeep Mewara
                wrote on last edited by
                #7

                Done! Sure... tell me how can i help..

                modified on Wednesday, June 2, 2010 5:58 AM

                1 Reply Last reply
                0
                • B BalasubramanianK

                  I am using Asp.Net 2.0. How can I avoid using back button after logged out from the page. Thanks in adv.

                  Balasubramanian K.

                  A Offline
                  A Offline
                  Arindam Tewary
                  wrote on last edited by
                  #8

                  The best option is (1) check for a valid session object as the first statement to be executed for your page load event handler. If there is no session (or session object is null you write code to redirect user to login and force user to create a session. Assumption is, while logging out code is written to clear Session which has been created at the time of "Login". (2) Sometime, developer creates "Base" page class and write this kind of session checking in base page itself so that every derived page class follows the same. This way, you can set aside any dependency of javascript. Hope it helps you,

                  Thanks, Arindam D Tewary

                  B 1 Reply Last reply
                  0
                  • A Arindam Tewary

                    The best option is (1) check for a valid session object as the first statement to be executed for your page load event handler. If there is no session (or session object is null you write code to redirect user to login and force user to create a session. Assumption is, while logging out code is written to clear Session which has been created at the time of "Login". (2) Sometime, developer creates "Base" page class and write this kind of session checking in base page itself so that every derived page class follows the same. This way, you can set aside any dependency of javascript. Hope it helps you,

                    Thanks, Arindam D Tewary

                    B Offline
                    B Offline
                    BalasubramanianK
                    wrote on last edited by
                    #9

                    Thanks to all.

                    Balasubramanian K.

                    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