ASP Hosting sale!
1,000MB space, 40GB transfer, 1 SQL Server 2000 db! - $9.95 per month*!
Limited Time Offer!

aspdev | articles | tutorials | forums

ASPdev -> ASP.NET Articles -> Disable browser caching in ASP.NET

Disable browser caching in ASP.NET

You know how annoying might be when you hit the back button in your browser and the ASP.NET web page displays a cached result instead of refreshing itself. There is a way to force the browser not to cache an ASP.NET web page and you need to add only 1 line of code to your ASP.NET web pages in order to disable browser caching.

Add the following line on top of the Page_Load event handler and your ASP.NET page will not be cached in the users browsers:

Response.Cache.SetCacheability(HttpCacheability.NoCache)




Contact Us