Solved

Pages not expiring

Posted on 2003-11-19
5
7,669 Views
Last Modified: 2013-12-23
I am using server-side coding and dtc controls.
At the top of every page I have the coding for:

  <%Response.buffer = true
  Response.Expires=0
  Response.ExpiresAbsolute=Now()-1
  Response.AddHeader "pragma","no-cache"
  Response.AddHeader "cache-control","no-cache"%>
I place this right before the page object coding and have tried moving it around but still doesn't expire the page.
problem is they won't expire.Some pages do expire, but only after an on_change event that forces a trip to the server and back.
I thought this has to do with the fact of the page object
Has anyone else had this problem and if so, how did you solve it?
I can not re-write all the pages.
 
0
Comment
Question by:bearpaws
5 Comments
 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 500 total points
ID: 9786142
<HEAD>

<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CHACHE">
</HEAD>

if you place the following code at the top of your page (before html tag) and at the end of the page (after html tag) then your page expires

and i am sure if u place your code in tow head tags and place at start and begin, your page expires

<head>
 <%Response.buffer = true
  Response.Expires=0
  Response.ExpiresAbsolute=Now()-1
  Response.AddHeader "pragma","no-cache"
  Response.AddHeader "cache-control","no-cache"%>
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CHACHE">

</head>

<html>
  <all other stuff>
</html>
<head>
 <%Response.buffer = true
  Response.Expires=0
  Response.ExpiresAbsolute=Now()-1
  Response.AddHeader "pragma","no-cache"
  Response.AddHeader "cache-control","no-cache"%>
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CHACHE">

</head>
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9786160
>>I can not re-write all the pages.

I suggest atleast to do this

place your code in one inc file and

include that file at top of html and end of html

this is the only solution as of now

if any other solutions are there, i suggest you

regards
0
 

Author Comment

by:bearpaws
ID: 9802392
I have tried it all three ways, and they simply do not expire.
This is so wierd.
0
 

Expert Comment

by:niuyuewanzi
ID: 10429551
hi

try this,

<% Response.CacheControl = "no-cache" %>
<% Response.AddHeader "Pragma", "no-cache" %>
<% Response.Expires = -1 %>

put the code above at the top of your page.

Note: Pragma: no-cache prevents caching only when used over a secure connection. A Pragma: no-cache META tag is treated identically to Expires: -1 if used in a non-secure page. The page will be cached but marked as immediately expired.
0
 

Expert Comment

by:Leifons
ID: 10800156
Hi,

I've tried this a number of times and it never works a 100 percent. The Meta Headers can also be added using IIS but that isn't true always either. A fail safe way to prevent pages from beeing cached, or actually, forcing a page to reload completely is to add a randomized value to the querystring. This always works!!!

Simply use the Randomize Statement followed by a generated random value and add it to the hyper link or forms action property on the page that refers to the page that shouldn't be cached.

For example:
-----------------------
<%
' Declare Variables
Dim intCounter, intDecimal, strValue
' Create a 6-Character random value
For intCounter = 1 To 6
    ' Generate a random number between 65 and 90.
    Randomize
    intDecimal =  Int((26 * Rnd) + 1) + 64
      
    ' Create random Character String
    strValue = strValue & Chr(intDecimal)
Next
%>
<form id="myForm" action="myPage.asp?blah=<%=strValue%>" method="post">
'-- or --
<a href="myPage.asp?blah=<%=strValue%>">don't cache</a>
-----------------------


Good Luck!
/Leif
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When deciding to adopt any help desk solutions many factors should be explored before taking decisions. This will change from business to another but in general there are some kind of rule of thumb. Here are some quick tips: Do we need only ticket…
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question