Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Search Your Question

Saturday, April 26, 2008

Is it possible to prevent a browser from caching an ASPX page?

Yes. You have to call SetNoStore on the HttpCachePolicy object exposed through the Response object's Cache property,

example :

Response.Cache.SetNoStore ();
Response.Write (DateTime.Now.ToLongTimeString ());

SetNoStore works by returning a Cache-Control: private, no-store header in the HTTP response.

In this example, it prevents caching of a Web page that shows the current time.

No comments:

Archives