Created
August 14, 2013 15:37
-
-
Save kmlprtsng/6232245 to your computer and use it in GitHub Desktop.
Stop Browser Caching
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Stop Caching - Solution 1 | |
| Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1)); | |
| Response.Cache.SetCacheability(HttpCacheability.NoCache); | |
| Response.Cache.SetNoStore(); | |
| //Solution 2 | |
| Response.AppendHeader("Cache-Control", "no-cache"); //HTTP 1.1 | |
| Response.AppendHeader("Cache-Control", "private"); // HTTP 1.1 | |
| Response.AppendHeader("Cache-Control", "no-store"); // HTTP 1.1 | |
| Response.AppendHeader("Cache-Control", "must-revalidate"); // HTTP 1.1 | |
| Response.AppendHeader("Cache-Control", "max-stale=0"); // HTTP 1.1 | |
| Response.AppendHeader("Cache-Control", "post-check=0"); // HTTP 1.1 | |
| Response.AppendHeader("Cache-Control", "pre-check=0"); // HTTP 1.1 | |
| Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.1 | |
| Response.AppendHeader("Keep-Alive", "timeout=3, max=993"); // HTTP 1.1 | |
| Response.AppendHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT"); // HTTP 1.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment