Solved

Pages not expiring

Posted on 2003-11-19
5
7,667 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now