-1

When you click on browser back button, it brings page from cache not from server, But user will not be able to perform any action on page displayed after back button. So I want to to remove that pages in cache how can I achieve this asp.net core?

Andrei
  • 36,642
  • 31
  • 139
  • 196
Ali Shan
  • 11
  • 5
  • https://stackoverflow.com/questions/49547/how-to-control-web-page-caching-across-all-browsers – Mahdi Sep 14 '17 at 07:46
  • 5
    Possible duplicate of [How to control web page caching, across all browsers?](https://stackoverflow.com/questions/49547/how-to-control-web-page-caching-across-all-browsers) – Tom Sep 14 '17 at 07:49
  • yes thanks to both but i found this code `Response.Cache.SetCacheability(HttpCacheability.NoCache); // HTTP 1.1. Response.Cache.AppendCacheExtension("no-store, must-revalidate"); Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0. Response.AppendHeader("Expires", "0"); // Proxies.` everywhere but don't know how to use it in asp.net core where i need to paste it? – Ali Shan Sep 14 '17 at 07:54

1 Answers1

0

Add this to page_load

Response.Cache.SetCacheability(HttpCacheability.NoCache);

This is the only true answer although it's important to know that it's only a request to the browser to stop caching - it doesn't necessarily have to follow.

This needs to be included on every page you don't want the user to 'back button' onto.

R. Bandi
  • 83
  • 11