?
Solved

CGI App - how to stop caching of pages?

Posted on 2001-06-03
10
Medium Priority
?
182 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
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…
Suggested Courses

770 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