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 restrict a user getting access to pages after logout

How to restrict a user getting access to pages after logout

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

    Hi there, Here's a scenario: There's a public computer where many people log in to their bank accounts and do some online billpay. Assuming every individual remembers to log out, most people don't normally bother to close the browser before they leave. Once logged out, I want to restrict other users from viewing pages that have just been visited by the user before him/her. My problem is, in my web application if a user doesn't close the browser after logging out, the next user can simply click the Back button and be able to view that individual's account info!!! Not only that, one can just type in the filename on the navigation bar (eg: www.abcbank.com/myaccount.aspx) and get access to the page that has recently been viewed. How do I prevent this? (This doesn't happen once the browser is closed. The back button is disabled and when I type in the above mentioned url, it redirects me to login.aspx page as expected!) Suggestions please!!! This is so critical! Thanks a million. Anjani Shiwakoti Computer programs and social cultures are the same.

    N T 2 Replies Last reply
    0
    • A alfakappasigma

      Hi there, Here's a scenario: There's a public computer where many people log in to their bank accounts and do some online billpay. Assuming every individual remembers to log out, most people don't normally bother to close the browser before they leave. Once logged out, I want to restrict other users from viewing pages that have just been visited by the user before him/her. My problem is, in my web application if a user doesn't close the browser after logging out, the next user can simply click the Back button and be able to view that individual's account info!!! Not only that, one can just type in the filename on the navigation bar (eg: www.abcbank.com/myaccount.aspx) and get access to the page that has recently been viewed. How do I prevent this? (This doesn't happen once the browser is closed. The back button is disabled and when I type in the above mentioned url, it redirects me to login.aspx page as expected!) Suggestions please!!! This is so critical! Thanks a million. Anjani Shiwakoti Computer programs and social cultures are the same.

      N Offline
      N Offline
      Nadeem Akhter
      wrote on last edited by
      #2

      Dear Anjani, The Solution of your problem is Session variable you need to create a session when user login into his account a session will start and then user will check its Balances and related info When page will load first of all it checkes for login session if the user is login then page will open if the user has log out then page will not open.:^) every time page will check for scession if scession will expire then page will not open and request for re-login. Rgds, Muhammad Nadeem.

      A 1 Reply Last reply
      0
      • N Nadeem Akhter

        Dear Anjani, The Solution of your problem is Session variable you need to create a session when user login into his account a session will start and then user will check its Balances and related info When page will load first of all it checkes for login session if the user is login then page will open if the user has log out then page will not open.:^) every time page will check for scession if scession will expire then page will not open and request for re-login. Rgds, Muhammad Nadeem.

        A Offline
        A Offline
        alfakappasigma
        wrote on last edited by
        #3

        Hi Muhammad, Thanks for the tip but I have already created a session variable in my login.aspx page. And on successful login, I am also able to display username stored in the session variable in other pages. Here's a subroutine that I used in my login.aspx : Sub Submit_Click(s As Object, e as EventArgs) If Page.IsValid Then If (Authenticate(Username.Text, Passwrd.Text) = 1) Then Session("sessionUsername") = Request("Username") System.Web.Security.FormsAuthentication.SetAuthCookie(Username.Text, False) System.Web.Security.FormsAuthentication.RedirectFromLoginPage(Username.Text, False) Else lblDisplayMessage.Text = "Invalid Username or Password." End If End If End Sub And here's a subroutine from my logout.aspx : Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Mybase.Load Session.Abandon() System.Web.Security.FormsAuthentication.SignOut() End Sub Could you please suggest me if I can do anything else to make my site work better and more secure? How come I can still go back to previously viewed pages even after I logout? How come I can still type in the url and view that page? do i have to create a session variable in web.config as well? Here's a snippet: Thanks, Anjani Computer programs and social cultures are the same. -- modified at 20:18 Saturday 14th January, 2006

        A K 2 Replies Last reply
        0
        • A alfakappasigma

          Hi Muhammad, Thanks for the tip but I have already created a session variable in my login.aspx page. And on successful login, I am also able to display username stored in the session variable in other pages. Here's a subroutine that I used in my login.aspx : Sub Submit_Click(s As Object, e as EventArgs) If Page.IsValid Then If (Authenticate(Username.Text, Passwrd.Text) = 1) Then Session("sessionUsername") = Request("Username") System.Web.Security.FormsAuthentication.SetAuthCookie(Username.Text, False) System.Web.Security.FormsAuthentication.RedirectFromLoginPage(Username.Text, False) Else lblDisplayMessage.Text = "Invalid Username or Password." End If End If End Sub And here's a subroutine from my logout.aspx : Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Mybase.Load Session.Abandon() System.Web.Security.FormsAuthentication.SignOut() End Sub Could you please suggest me if I can do anything else to make my site work better and more secure? How come I can still go back to previously viewed pages even after I logout? How come I can still type in the url and view that page? do i have to create a session variable in web.config as well? Here's a snippet: Thanks, Anjani Computer programs and social cultures are the same. -- modified at 20:18 Saturday 14th January, 2006

          A Offline
          A Offline
          abhinish
          wrote on last edited by
          #4

          U r able to view the previous page because that page is in cache of web browser at the lime of logout clear the cache. this may help abhinav

          N 1 Reply Last reply
          0
          • A abhinish

            U r able to view the previous page because that page is in cache of web browser at the lime of logout clear the cache. this may help abhinav

            N Offline
            N Offline
            Nadeem Akhter
            wrote on last edited by
            #5

            Ok if you already creating a session and when u log off from your account (dispose the session .. or abondon the session ) you have to write the B/M Code in Every page load's Event If Session("uname") = "" Then Server.Transfer("login.aspx") Else lblmsg.Text = " Well Come to " & Session("uname") End If when page will load it will check for the username if user will login the page will show else the page will not show and Control will be transfer to login.aspx page.. Regards, Muhammad Nadeem.

            1 Reply Last reply
            0
            • A alfakappasigma

              Hi there, Here's a scenario: There's a public computer where many people log in to their bank accounts and do some online billpay. Assuming every individual remembers to log out, most people don't normally bother to close the browser before they leave. Once logged out, I want to restrict other users from viewing pages that have just been visited by the user before him/her. My problem is, in my web application if a user doesn't close the browser after logging out, the next user can simply click the Back button and be able to view that individual's account info!!! Not only that, one can just type in the filename on the navigation bar (eg: www.abcbank.com/myaccount.aspx) and get access to the page that has recently been viewed. How do I prevent this? (This doesn't happen once the browser is closed. The back button is disabled and when I type in the above mentioned url, it redirects me to login.aspx page as expected!) Suggestions please!!! This is so critical! Thanks a million. Anjani Shiwakoti Computer programs and social cultures are the same.

              T Offline
              T Offline
              Tiger456
              wrote on last edited by
              #6

              Hai Disable Page client Side Cacheing . It can be done in in two ways ServerSide Response.Cache.SetCacheability(HttpCacheability.NoCache); Client Side Regards

              1 Reply Last reply
              0
              • A alfakappasigma

                Hi Muhammad, Thanks for the tip but I have already created a session variable in my login.aspx page. And on successful login, I am also able to display username stored in the session variable in other pages. Here's a subroutine that I used in my login.aspx : Sub Submit_Click(s As Object, e as EventArgs) If Page.IsValid Then If (Authenticate(Username.Text, Passwrd.Text) = 1) Then Session("sessionUsername") = Request("Username") System.Web.Security.FormsAuthentication.SetAuthCookie(Username.Text, False) System.Web.Security.FormsAuthentication.RedirectFromLoginPage(Username.Text, False) Else lblDisplayMessage.Text = "Invalid Username or Password." End If End If End Sub And here's a subroutine from my logout.aspx : Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Mybase.Load Session.Abandon() System.Web.Security.FormsAuthentication.SignOut() End Sub Could you please suggest me if I can do anything else to make my site work better and more secure? How come I can still go back to previously viewed pages even after I logout? How come I can still type in the url and view that page? do i have to create a session variable in web.config as well? Here's a snippet: Thanks, Anjani Computer programs and social cultures are the same. -- modified at 20:18 Saturday 14th January, 2006

                K Offline
                K Offline
                ketan d patel
                wrote on last edited by
                #7

                See following link i am using that once. http://dotnet-magic.blogspot.com/2009/04/how-to-restrict-user-getting-access-to.html[^]

                http://dotnet-magic.blogspot.com/

                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