1

in my recent asp.net (c#) website project a user needs to login to view a secure.aspx page. after logging in when a user clicks logout link from secure.aspx page, the user logs out, and redirected to login page.. but after that if the user presses the back button of the browser, the browser shows the secured pages,but in this state if user clicks any button or anything else that post backs the page, the login page is being displayed. is everything ok with logout control?

Krishanu Dey
  • 6,326
  • 7
  • 51
  • 69

3 Answers3

4

Everything's okay with the logout control; you can't help the fact that the browser keeps history. Don't worry, the page is only a local cached copy for history; there is no problem in the permissions and the user is not actually logged in, though s/he may appear to be.

Ry-
  • 218,210
  • 55
  • 464
  • 476
0

you can also try turning off caching for the page which will prevent that for most browsers.

NSGaga-mostly-inactive
  • 14,052
  • 3
  • 41
  • 51
0

It's a default behavior, can have its cons and pros.. However, there has been recently a thread discussing a quite similar topic which may help you to prevent this behavior if you want.

Look here for more info: Reloading page when user arrives from back button

EDIT based on the comment:

If you want the browser to stop caching your pages, you can try to add this inside your head part of the masterpage:

<head>
   <meta http-equiv="cache-control" content="no-cache" />
   <meta http-equiv="pragma" content="no-cache" />
   <meta http-equiv="expires" content="-1" />
   ...
</head>

See if it helps.

Community
  • 1
  • 1
walther
  • 13,466
  • 5
  • 41
  • 67
  • I understood the trick. I want to use this in my masterpage, is it possible? if yes, then please give some example. – Krishanu Dey Apr 03 '12 at 05:07
  • @KrishanuDey by that you mean, that you would like to turn of caching for your whole website (or directory)? – walther Apr 03 '12 at 09:28
  • Yes. The caching of whole website will be disabled. – Krishanu Dey Apr 03 '12 at 12:03
  • Just a few minutes ago when i tried my old code (without using any of your solutions) to browse in IE8, it was ok (i was redirected to my login page). but in FireFox The problem still exists. – Krishanu Dey Apr 03 '12 at 15:07