Solved

Pages not expiring

Posted on 2003-11-19
5
7,674 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

 Database Backup and Recovery Best Practices

Join Percona’s, Architect, Manjot Singh as he presents Database Backup and Recovery Best Practices (with a Focus on MySQL) on Thursday, July 27, 2017 at 11:00 am PDT / 2:00 pm EDT (UTC-7). In the case of a failure, do you know how long it will take to restore your database?

Question has a verified solution.

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

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
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…
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 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…

627 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