Solved

CGI App - how to stop caching of pages?

Posted on 2001-06-03
10
181 Views
Last Modified: 2010-04-06
How can I get my CGI app to force the browser not to cache.  I want a particular action in my CGI app to always load from the server, not from cache.

I know the following html code works on plain html pages, but it doesn't work through my CGI app:
<head>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Expires" CONTENT="Mon, 01 Jan 1996 23:59:59 GMT">
</head>

I've tried the following code in my CGI action, but it doesn't seem to work either:
Response.Date := Now-1;
Response.Expires := Now-1;

Any help will be appreciated
0
Comment
Question by:cjclayton
[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
10 Comments
 
LVL 7

Expert Comment

by:Motaz
ID: 6151460
I have faced this problem befor, this code works fine in Win98 computers, and NT, but not with Win2000, I'm not sure is it a Web server problem or client problem.

Motaz
0
 

Author Comment

by:cjclayton
ID: 6151475
I worked it out:
Response.SetCustomHeader('Cache-Control', 'no-store');
Response.SetCustomHeader('Pragma', 'no-store');
Response.SetCustomHeader('Expires', 'Mon, 01 Jan 1996 23:59:59 GMT');
0
 
LVL 7

Expert Comment

by:Motaz
ID: 6151529
Did it works!! and in which windows version and web server

Motaz
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:cjclayton
ID: 6151574
Should be:
Response.SetCustomHeader('Cache-Control', 'no-store');
Response.SetCustomHeader('Pragma', 'no-cache');
Response.SetCustomHeader('Expires', 'Mon, 01 Jan 1996 23:59:59 GMT');

Yes it did work! :)
I'm compiling on a W2K machine in Delphi 5 and releasing the exe on a NT 4 machine. I'm using IIS 4.

0
 
LVL 7

Expert Comment

by:Motaz
ID: 6151760
cjclayton, I'll give you points for this solution, because I need it too.

btw. How did you know that solution? did you read it in a book?

Motaz
0
 
LVL 7

Expert Comment

by:Motaz
ID: 6151767
I post points to you, did you find it?
0
 

Author Comment

by:cjclayton
ID: 6151816
I was reading the delphi help for TWebResponse and came across the method SetCustomHeader().  I then found a couple of examples (found via www.yahoo.com - entered SetCustomHeader), but it wasn't for caching e.g.

SetCustomHeader('Content-Disposition', 'filename='+ExtractFilename(iFilename));
(I think it is used for downloading files, or something)

I then tried entering in the meta http-equiv caching values instead and it just worked!

Luck was on my side! :)
0
 

Author Comment

by:cjclayton
ID: 6152274
How do I get the points?
0
 
LVL 3

Expert Comment

by:nnbbb09
ID: 6174020
0
 

Accepted Solution

by:
amp072397 earned 0 total points
ID: 6201923
PAQing this question.

amp
Community Support Moderator
Experts Exchange
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

726 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