1.

Is It Possible To Prevent A Browser From Caching An Aspx Page?

Answer»

Just CALL SetNoStore on the HttpCachePolicy object exposed through the RESPONSE object’s Cache property, as demonstrated here:

<%@ Page Language=”C#” %>

<%
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.

Just call SetNoStore on the HttpCachePolicy object exposed through the Response object’s Cache property, as demonstrated here:

<%@ Page Language=”C#” %>

<%
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.



Discussion

No Comment Found