Sunday, February 27, 2011

How to disable cacheing on page

To Prevent caching of web pages by browsers

The web pages you view are stored by your system inside the cache directory. Now, when you view these pages again, the browser searches the cache, and if it finds the page there, it displays it immediately. This presents problems to web developers when they update a page since the visitors see an older version (that was stored in the cache) of the page.

To prevent this from happening set the expiration date in the past inside the <meta>. Thus the browser reloads the page everytime the user visits.

Use below code

<meta http-equiv="expires" value="Thu, 16 Mar 2000
11:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />

Another way to do this is by writing code:

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:


Solution by: Rajesh Rolen

Share This!

No comments:

Powered By Blogger · Designed By Seo Blogger Templates