Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
where the following code is added .in AddHeader what is "Pragma" is it fixed for all

var lastModified = DateTime.UtcNow;
var expires = lastModified - TimeSpan.FromDays(365);
Response.Cache.SetExpires(expires);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Posted

Please, edit your original post if you need more info. This relates to another question. And, why did you ask this without first trying it ? It doesn't matter where you put it.
wrote:
Response.Cache.SetCacheability(HttpCacheability.NoCache);


by itself will fix the problem, I believe. Either way, putting all this code somewhere in your page, or in a base class that you use, will work, no matter where you put it.
 
Share this answer
 
Response.AddHeader("Pragma", "no-cache");

doesnt work before the page is actually parsed properly. So if is better to write a new head at the bottom of the page with this meta tag.

It actually goes to find the page in the cache after the half of its buffer size is reached.

So your page might look like
<html>

<head>

<meta HTTP-EQUIV="REFRESH" content="5">
<title>New Title </TITLE>
</head>

<body>
Blah !! Blah !! Blah !! Blah !! Blah !! 
</body>

<head>

<meta HTTP-EQUIV="PRAGMA" content="NO-CACHE">
</head>

</html>


:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900