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 to secure webpages when we click on back button on browser?

how to secure webpages when we click on back button on browser?

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
12 Posts 7 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.
  • R Offline
    R Offline
    Raheem MA
    wrote on last edited by
    #1

    Hi, I have some webpages for a small project. I have login page also. after logout, when I click on Back button It takes me to previously visited page. but then it should ask to login... How can WE do to ask the credentials when we click BACK button, after logging out? thanks in advance... shah_tech

    S S S R S 5 Replies Last reply
    0
    • R Raheem MA

      Hi, I have some webpages for a small project. I have login page also. after logout, when I click on Back button It takes me to previously visited page. but then it should ask to login... How can WE do to ask the credentials when we click BACK button, after logging out? thanks in advance... shah_tech

      S Offline
      S Offline
      steffw
      wrote on last edited by
      #2

      Maybe you can redirect them to the login page after loggin out. if they push the back button now they wil be redirected again to the login :)

      Stef

      R 1 Reply Last reply
      0
      • R Raheem MA

        Hi, I have some webpages for a small project. I have login page also. after logout, when I click on Back button It takes me to previously visited page. but then it should ask to login... How can WE do to ask the credentials when we click BACK button, after logging out? thanks in advance... shah_tech

        S Offline
        S Offline
        suyuan1984
        wrote on last edited by
        #3

        if you use the session,after check logout,you should remove the session,and you should check the session in the loginpage.

        my english is very bad!

        R 1 Reply Last reply
        0
        • S steffw

          Maybe you can redirect them to the login page after loggin out. if they push the back button now they wil be redirected again to the login :)

          Stef

          R Offline
          R Offline
          Raheem MA
          wrote on last edited by
          #4

          yeah, thanks for ur rply... I'm redirecting to login page only after logging out, but there after, if i click on BACK button, it takes me to previously visited page which is not desirable. thanks in advance.

          1 Reply Last reply
          0
          • R Raheem MA

            Hi, I have some webpages for a small project. I have login page also. after logout, when I click on Back button It takes me to previously visited page. but then it should ask to login... How can WE do to ask the credentials when we click BACK button, after logging out? thanks in advance... shah_tech

            S Offline
            S Offline
            Sandeep Akhare
            wrote on last edited by
            #5

            How are you maintaining the state of user in your application ?

            Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

            R 1 Reply Last reply
            0
            • S suyuan1984

              if you use the session,after check logout,you should remove the session,and you should check the session in the loginpage.

              my english is very bad!

              R Offline
              R Offline
              Raheem MA
              wrote on last edited by
              #6

              thanks suyuan, i'm using Sessions in my application. for logout, i'm using Hyperlink ( navigateUrl as Login.aspx. then where can i remove the session? I checked as removing session in page_load of Login.aspx, but it's not working.

              S 1 Reply Last reply
              0
              • S Sandeep Akhare

                How are you maintaining the state of user in your application ?

                Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

                R Offline
                R Offline
                Raheem MA
                wrote on last edited by
                #7

                Hi Sandeep, I'm using Sessions to maintain state of user.

                S 1 Reply Last reply
                0
                • R Raheem MA

                  Hi Sandeep, I'm using Sessions to maintain state of user.

                  S Offline
                  S Offline
                  Sandeep Akhare
                  wrote on last edited by
                  #8

                  You need to check the user id and password every time in each page from session if the session is empty or wrong user id and password you should able to redirect user to login page . When you click sign out remove the data from the session . But i don't think this is solution for your query as it is happenening because of Cache. Wait need to find different way

                  Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

                  E 1 Reply Last reply
                  0
                  • S Sandeep Akhare

                    You need to check the user id and password every time in each page from session if the session is empty or wrong user id and password you should able to redirect user to login page . When you click sign out remove the data from the session . But i don't think this is solution for your query as it is happenening because of Cache. Wait need to find different way

                    Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

                    E Offline
                    E Offline
                    enjoycrack
                    wrote on last edited by
                    #9

                    ya..that's the client matter...look thru this discussion http://forums.asp.net/thread/1674644.aspx[^] << >>

                    8x Solutions Ltd

                    1 Reply Last reply
                    0
                    • R Raheem MA

                      thanks suyuan, i'm using Sessions in my application. for logout, i'm using Hyperlink ( navigateUrl as Login.aspx. then where can i remove the session? I checked as removing session in page_load of Login.aspx, but it's not working.

                      S Offline
                      S Offline
                      suyuan1984
                      wrote on last edited by
                      #10

                      to shah_tech: you can use a page(loginout.aspx) for clear session,after,let the page redirect to the login.aspx loginout.aspx'code like this: private void Page_Load(Object sender,EventArgs e) { if(!Page.IsPostBack) { Session.Clear(); Response.Write(""); } } I hope this can help you!:^)

                      my english is very bad!

                      1 Reply Last reply
                      0
                      • R Raheem MA

                        Hi, I have some webpages for a small project. I have login page also. after logout, when I click on Back button It takes me to previously visited page. but then it should ask to login... How can WE do to ask the credentials when we click BACK button, after logging out? thanks in advance... shah_tech

                        R Offline
                        R Offline
                        Rahul Babu
                        wrote on last edited by
                        #11

                        Request.UrlReferrer.AbsoluteUri the above will give the URL of the page from which u r redirected to the current page. Compare this url with the login page url for eg: in the page load event if(Request.UrlReferrer.AbsoluteUri!="http://localhost/Login.aspx") { Response.Redirect("Login.aspx"); }

                        1 Reply Last reply
                        0
                        • R Raheem MA

                          Hi, I have some webpages for a small project. I have login page also. after logout, when I click on Back button It takes me to previously visited page. but then it should ask to login... How can WE do to ask the credentials when we click BACK button, after logging out? thanks in advance... shah_tech

                          S Offline
                          S Offline
                          Sherin Iranimose
                          wrote on last edited by
                          #12

                          Hi, Try this code inside your pageload Response.Buffer = True Response.ExpiresAbsolute = DateTime.Now.AddDays(-1D) Response.Expires = -1500 Response.CacheControl = "no-cache"

                          Sherin Iranimose

                          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