Solved

CGI App - how to stop caching of pages?

Posted on 2001-06-03
10
175 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
 

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now