• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

CGI App - how to stop caching of pages?

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
cjclayton
Asked:
cjclayton
1 Solution
 
MotazCommented:
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
 
cjclaytonAuthor Commented:
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
 
MotazCommented:
Did it works!! and in which windows version and web server

Motaz
0
Independent Software Vendors: 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!

 
cjclaytonAuthor Commented:
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
 
MotazCommented:
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
 
MotazCommented:
I post points to you, did you find it?
0
 
cjclaytonAuthor Commented:
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
 
cjclaytonAuthor Commented:
How do I get the points?
0
 
nnbbb09Commented:
0
 
amp072397Commented:
PAQing this question.

amp
Community Support Moderator
Experts Exchange
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now