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

Answer Posted / surendra singh

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

<%@ Page Language="C#" %>
<html>
<body>
<%
Response.Cache.SetNoStore ();
Response.Write (DateTime.Now.ToLongTimeString ());
%>
</body>
</html>
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.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you handle server controls?

657


Give a few examples of page life cycle events.

675


Differentiate between namespace and assembly.

565


What is the difference between a candidate key and primary key?

521


What is application in asp net?

494






What is the difference between typeof() vs gettype()?

553


Can we have a web application running without web.config file?

525


What are the features that make asp.net more used framework? : asp.net mvc

544


How to set the pane area to transparent of a scrollPane component.?

566


What is a reflection?

586


What is the difference between user control and custom control?

486


What is a 401 redirect?

511


What is session object? Describe in detail.

562


Why do you use the app_code folder in asp.net?

552


What is use of <% %> in asp.net?

548