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. Handle the Back Button in Browser?

Handle the Back Button in Browser?

Scheduled Pinned Locked Moved ASP.NET
questiontutorial
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.
  • C Offline
    C Offline
    chand10
    wrote on last edited by
    #1

    Hi In my application their is a situation where I have to Handle the Back Button of the Browser, I have to either 1.Disable the Back Button for that page or 2.Redirect the current page to LoginPage. How can I do both the ways. Suggest me an example.

    I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

    C T A N 4 Replies Last reply
    0
    • C chand10

      Hi In my application their is a situation where I have to Handle the Back Button of the Browser, I have to either 1.Disable the Back Button for that page or 2.Redirect the current page to LoginPage. How can I do both the ways. Suggest me an example.

      I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

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

      1 - impossible 2 - stupid. If someone clicks back, why would they need to login ? If they have logged out, your app should store that they are logged out, and thus redirect, regardless of if they click back, or where they navigate to.

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      1 Reply Last reply
      0
      • C chand10

        Hi In my application their is a situation where I have to Handle the Back Button of the Browser, I have to either 1.Disable the Back Button for that page or 2.Redirect the current page to LoginPage. How can I do both the ways. Suggest me an example.

        I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

        T Offline
        T Offline
        T EDY
        wrote on last edited by
        #3

        1. Impossible 2. Why u need that:confused:i think u must have a session in your web pages so u can manage the user on your application Regard, Tomi

        1 Reply Last reply
        0
        • C chand10

          Hi In my application their is a situation where I have to Handle the Back Button of the Browser, I have to either 1.Disable the Back Button for that page or 2.Redirect the current page to LoginPage. How can I do both the ways. Suggest me an example.

          I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

          A Offline
          A Offline
          Archana New to Dotnet
          wrote on last edited by
          #4

          Put this script inside Head tag of the page. history.forward(); eg.suppose we have to pages.1)default1.aspx 2)default2.aspx if we apply this script to default1.aspx and we use response.redirect to goto second page(default2.aspx)we cant use back button in default2.apsx

          N 1 Reply Last reply
          0
          • A Archana New to Dotnet

            Put this script inside Head tag of the page. history.forward(); eg.suppose we have to pages.1)default1.aspx 2)default2.aspx if we apply this script to default1.aspx and we use response.redirect to goto second page(default2.aspx)we cant use back button in default2.apsx

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

            What will happen if client has disabled javascript. ? You should not relay on javascript never. Moreover it's not a good solution too.


            My Website | Ask smart questions

            V 1 Reply Last reply
            0
            • C chand10

              Hi In my application their is a situation where I have to Handle the Back Button of the Browser, I have to either 1.Disable the Back Button for that page or 2.Redirect the current page to LoginPage. How can I do both the ways. Suggest me an example.

              I have not failed. I've just found 10,000 ways that won't work. -Thomas A. Edison Thank u Chandu

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

              chand10 wrote:

              .Disable the Back Button for that page or

              Disabling back button with some scripts is not a good solution. If you don't want user to come back and do changes on previous page, I think you need to disable caching for the first page. But I am not sure with this method


              My Website | Ask smart questions

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

                What will happen if client has disabled javascript. ? You should not relay on javascript never. Moreover it's not a good solution too.


                My Website | Ask smart questions

                V Offline
                V Offline
                Vasudevan Deepak Kumar
                wrote on last edited by
                #7

                N a v a n e e t h wrote:

                if client has disabled javascript

                Stone age web browsers. :mad:

                Vasudevan Deepak Kumar Personal Homepage Tech Gossips

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

                  chand10 wrote:

                  .Disable the Back Button for that page or

                  Disabling back button with some scripts is not a good solution. If you don't want user to come back and do changes on previous page, I think you need to disable caching for the first page. But I am not sure with this method


                  My Website | Ask smart questions

                  V Offline
                  V Offline
                  Vasudevan Deepak Kumar
                  wrote on last edited by
                  #8

                  N a v a n e e t h wrote:

                  to come back

                  It is better to look ahead in life rather than turning back. My car always prefer to go further take a U-turn instead of using the reverse gears unless otherwise the road conditions stipulate otherwise. :)

                  Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                  N 1 Reply Last reply
                  0
                  • V Vasudevan Deepak Kumar

                    N a v a n e e t h wrote:

                    to come back

                    It is better to look ahead in life rather than turning back. My car always prefer to go further take a U-turn instead of using the reverse gears unless otherwise the road conditions stipulate otherwise. :)

                    Vasudevan Deepak Kumar Personal Homepage Tech Gossips

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

                    That's fine. Even me also like to do so. I just told a scenario, I know people who still use old browsers. If full application security is depends on javascript , it still sounds bad for me.


                    My Website | Ask smart questions

                    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