How to block previous page after logging off

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Matsam
    New Member
    • Jun 2007
    • 33

    How to block previous page after logging off

    Hi,

    I have an ASP page that displays the account details of individual users, to which they can login using their user name & password. I have given a link for "Logout". When a user clicks this link, I am loading another page, say "Page1", which displays "You have successfully logged out..". But if the user clicks the Back button in the browser, the previous page showing the account details is displayed.
    Is there any simple way to block/disable the Back button or close the browser when the user clicks "Logout" link ?
    Please help me..

    Thanks in advance

    Matsam
  • Ranjan kumar Barik
    New Member
    • Aug 2007
    • 95

    #2
    Originally posted by Matsam
    Hi,

    I have an ASP page that displays the account details of individual users, to which they can login using their user name & password. I have given a link for "Logout". When a user clicks this link, I am loading another page, say "Page1", which displays "You have successfully logged out..". But if the user clicks the Back button in the browser, the previous page showing the account details is displayed.
    Is there any simple way to block/disable the Back button or close the browser when the user clicks "Logout" link ?
    Please help me..

    Thanks in advance

    Matsam
    Hi, Matsam
    I hope after logout is clicked, if you redirect the page to the home page or may be to login page and if you abandon the session so that when you can check for session exist or not in the page and if the session is abandoned you can redirect him to the login page, will work.
    Thanks

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      I agree with Ranjan. At the time of login you should set some session-level variable: [code=asp]session("userId ") = "john"[/code]at time of log out, clear all of the session variables [code=asp]for each x in session
      session(x) = ""
      next[/code]at the top of every page (especially every page with sensitive account information) redirect to the login page if the session("userId ") is not filled [code=asp]if session("userId ") = "" then response.redire ct "login.asp"[/code] then you just need to make sure the page isn't cached (this is an HTML property, I don't remember the code off-hand) so that the user's computer doesn't store any of that info. Does this answer your question.

      Jared

      Comment

      Working...