Solved

CGI App - how to stop caching of pages?

Posted on 2001-06-03
10
179 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
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

830 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