2

I want to protect the users by not going back to the previous pages, consider the ex in banking sites where if we click "back" button, it shows "warning page expired" page.

In Asp.Net, how to do that.

I tried with the following options, but it doesnt work.

Option 1:-

<meta http-equiv="expires" content="0" /> 

Option 2 :-

<meta http-equiv="PRAGMA" content="NO-CACHE" />

Option 3:- on Page_Load()

Response.Cache.SetCacheability(HttpCacheability.NoCache); 
        Response.Cache.SetNoStore();
        Response.Cache.SetExpires(DateTime.Now.AddMinutes(-1));

Thanks in advance.

Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304
user898254
  • 41
  • 4
  • 1
    Also I've this issue. Waiting for response. – Krishanu Dey May 21 '12 at 12:37
  • Bottom line: your application must do this server-side. See this [SO thread](http://stackoverflow.com/q/961188/304683). Note **all** the answers and comments, not just the accepted answer. – EdSF May 21 '12 at 13:46

1 Answers1

0

Edit following line in your solution:

Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache)
Estefany Velez
  • 328
  • 4
  • 18
  • Similar post > http://stackoverflow.com/questions/64059/is-there-a-way-to-keep-a-page-from-rendering-once-a-person-has-logged-out-but-hi – Estefany Velez Jun 04 '12 at 13:32