Is it possible to prevent a browser from caching an ASPX
page?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
Define a web service in .net?
What are type/key pairs in client script registration?
What is viewstate information stored?
What is the function used for removing an event listener?
Where session variables are stored?
asp.net interview questions
Define WCF ABC , Diffrent Contract. Diff b/w Wcf and in webservice
How to add DateTime Control in normal DataGrid Server Control?
detail code for sql data connections?
What is .net remoting?
What is the difference between system.stringbuilder and system.string
What is the latest version of asp.net?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)