Code
Response.Cache.SetNoStore();
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.AddHeader("Pragma", "no-cache");
//Tell proxy servers
not to cache the page.
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
The following code will prevent the web page from being cached by the Client Browser. Use this code in pageload.
Code
Response.Cache.SetNoStore();
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.AddHeader("Pragma", "no-cache");
//Tell proxy servers
not to cache the page.
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegisterMembers onlyeBook · C#Modern CSharp Mastery - Advanced Guide for Experienced DevelopersDownload nowWrite a blog post and earn +250 SHARP when it is approved.
Write a blog
Join the conversation! Your thoughts help the community grow.