Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Pages not expiring

Posted on 2003-11-19
5
Medium Priority
?
7,678 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 2000 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

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 …
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…

688 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