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. Disabling Back Button

Disabling Back Button

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-net
9 Posts 6 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.
  • Y Offline
    Y Offline
    Yonathan1111
    wrote on last edited by
    #1

    Hello everybody, I'm working with asp.net and my project has login interface which accepts user's information and redirects to another page. After a user has logedout s/he never return to that page,but this doesn't happen,in contrast, when the user uses the back button s/he can again visit the page. I want to disable the back button, how can I? Or is there another method to do that? Thank you.

    N D R Y C 5 Replies Last reply
    0
    • Y Yonathan1111

      Hello everybody, I'm working with asp.net and my project has login interface which accepts user's information and redirects to another page. After a user has logedout s/he never return to that page,but this doesn't happen,in contrast, when the user uses the back button s/he can again visit the page. I want to disable the back button, how can I? Or is there another method to do that? Thank you.

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

      You can't. You are seeing the browser cached version of the page and any well written application will not allow to proceed using the secured page. Each page load should check the session existence and do necessary redirects.

      Navaneeth How to use google | Ask smart questions

      Y 1 Reply Last reply
      0
      • Y Yonathan1111

        Hello everybody, I'm working with asp.net and my project has login interface which accepts user's information and redirects to another page. After a user has logedout s/he never return to that page,but this doesn't happen,in contrast, when the user uses the back button s/he can again visit the page. I want to disable the back button, how can I? Or is there another method to do that? Thank you.

        D Offline
        D Offline
        dan sh
        wrote on last edited by
        #3

        You cannot. Perfectly. Although there are plenty of ways available through web of doing this.

        It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

        Y 1 Reply Last reply
        0
        • Y Yonathan1111

          Hello everybody, I'm working with asp.net and my project has login interface which accepts user's information and redirects to another page. After a user has logedout s/he never return to that page,but this doesn't happen,in contrast, when the user uses the back button s/he can again visit the page. I want to disable the back button, how can I? Or is there another method to do that? Thank you.

          R Offline
          R Offline
          Rutvik Dave
          wrote on last edited by
          #4

          Disabled Back Button is not a good idea. And even if you check the Session object, still browser will load cached page as its not a postback. you can use following property to expire the content on the client side. but still it will not be real-time.

                  Response.Expires
                  Response.ExpiresAbsolute
          

          on the Logout page try setting Response.ExpiresAbsolute to the (DateTime.Now.AddSecond(5)) and see if that works.

          1 Reply Last reply
          0
          • Y Yonathan1111

            Hello everybody, I'm working with asp.net and my project has login interface which accepts user's information and redirects to another page. After a user has logedout s/he never return to that page,but this doesn't happen,in contrast, when the user uses the back button s/he can again visit the page. I want to disable the back button, how can I? Or is there another method to do that? Thank you.

            Y Offline
            Y Offline
            yesu prakash
            wrote on last edited by
            #5

            function noBack() { window.history.forward(); } noBack(); window.onload=noBack; window.onpageshow=function(evt){if(evt.persisted)noBack();} window.onunload=function(){void(0);} this javascript may help you

            1 Reply Last reply
            0
            • Y Yonathan1111

              Hello everybody, I'm working with asp.net and my project has login interface which accepts user's information and redirects to another page. After a user has logedout s/he never return to that page,but this doesn't happen,in contrast, when the user uses the back button s/he can again visit the page. I want to disable the back button, how can I? Or is there another method to do that? Thank you.

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              People ask this all the time. It's a stupid request. The answer you were given, is easily defeated. Instead, tell us how your code is broken or poorly written so that you need to do this ( i.e. tell us why you want to do it, I am sure it will mean we can tell you how to fix your code ).

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

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

                You can't. You are seeing the browser cached version of the page and any well written application will not allow to proceed using the secured page. Each page load should check the session existence and do necessary redirects.

                Navaneeth How to use google | Ask smart questions

                Y Offline
                Y Offline
                Yonathan1111
                wrote on last edited by
                #7

                Thank you all for your help.

                N 1 Reply Last reply
                0
                • D dan sh

                  You cannot. Perfectly. Although there are plenty of ways available through web of doing this.

                  It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

                  Y Offline
                  Y Offline
                  Yonathan1111
                  wrote on last edited by
                  #8

                  Thank you for your help.

                  1 Reply Last reply
                  0
                  • Y Yonathan1111

                    Thank you all for your help.

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

                    You are welcome. You may also reconsider your websites navigation model. Something like Post/Redirect/Get[^].

                    Best wishes, Navaneeth

                    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