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

Answers were Sorted based on User's Feedback



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

Answer / manoj

Write this code in the Page load event of the code behind :-

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Is This Answer Correct ?    5 Yes 2 No

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

Answer / swapna

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.

Is This Answer Correct ?    3 Yes 1 No

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

Answer / 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

More ASP.NET Interview Questions

Why do we need url encoding?

0 Answers  


Explain about asp.net caching?

0 Answers  


Whats the difference between abstract factory pattern and factory pattern?

0 Answers  


Is There any Third party tools are using in .Net Technologies? Can u Explain?

4 Answers   HCL,


Which method has beenintroduced in asp.net 4.0 to redirect a page permanently?

0 Answers  






What is the difference between Hash table and Array list?

0 Answers  


What is ASLM?

0 Answers   MCN Solutions,


When using the Pager object, inorder to know which page to go, which property you have to set to grid?

0 Answers   Siebel,


What is Web Server Control Templates.?

0 Answers   MCN Solutions,


what is the Difference between Dim Object as object AND dim obj as myform?

1 Answers   Microsoft,


Define transparent caching with aop?

0 Answers  


In cache where dats is stored and how(file or object?)

2 Answers  


Categories