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 can exception be handled with out the use of try catch?

539


Explain how can we inherit a static member?

528


What is the benefit of WebAPI over WCF?

566


What are Master Pages in ASP.NET?

571


What are the new web part controls in asp.net 2.0 ?

524






How do you declare static variable? What is its lifetime?

507


How would you get asp.net running in apache web servers? Explain it's limitations.

529


Why asp.net is used?

556


Explain how caching in asp.net 2.0 is different from caching in asp.net 1.1?

536


What are web beacons used for?

539


What does mvc represent in asp.net? : asp.net mvc

520


To display data in a Repeater control which template you provide?

586


How does a content page different from a master page?

572


What are the events that happen when a client requests an asp.net page from iis server?

479


Explain the different types of assemblies?

524