Pages not expiring

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.
 
bearpawsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sudhakar_koundinyaCommented:
<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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sudhakar_koundinyaCommented:
>>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
bearpawsAuthor Commented:
I have tried it all three ways, and they simply do not expire.
This is so wierd.
0
niuyuewanziCommented:
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
LeifonsCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.