Solved

Form POST Method w/ *TURNING ON * Cache: How??

Posted on 1998-09-07
2
152 Views
Last Modified: 2013-12-25
I have made a CGI-Perl script which is called from my starting HTM webpage via a form POST method.  All consecutive screens are generated from the CGI script.

The problem occurs when a user of the CGI generated webpage scews off and checks another HTM hyperlink on that page (ie. a help screen for the CGI generated webpage).  When he/she tries to return to the previous screen (the CGI generated webpage) via the BACK BUTTON, they are faced with the "annoying" message:
----
Data Missing

This document resulted from a POST operation and has expired from the cache. If you wish you can repost the
form data to recreate the document by pressing the reload button.
----

How do I tell my CGI-Perl script to output a webpage which is "cached" and won't expire with the POST method?  Do i need to use Non-parsed headers?

Thanks for any help.
0
Comment
Question by:ratboy2
2 Comments
 
LVL 11

Accepted Solution

by:
mouatts earned 50 total points
ID: 1828552
Non-parsed headers simply means that the server will not parse the header of the HTML (and for example outputing the HTTP headers that relate to the HTTP-EQUIV Meta tags).

As you are outputing the page from the CGI script you are already using non-paged headers.

What you need to do is output an HTTP header that instructs the client to turn caching on. Unfortunately no such header exists. However what you can do is to output an expiry header which should cause the page to be cached. The format of the expiry header record can be obtained from http://www.w3.org/.

Steve
0
 

Author Comment

by:ratboy2
ID: 1828553
Thanks for the reply Mouatts/Steve.

My cgi perl script is presently not a non-parsed header script, that is, my script file name is just TOM.CGI and not NPH-TOM.CGI.

As for the output HTTP header I have the following code at the top of my script:

print "Expires: Fri, 31 Dec 1999 23:00:00 GMT\n";
print "Content-type: text/html\n\n";

This is output as a response to a POST request.  However in Netscape it will still leave the response page from the script non-cached.  Sometimes, though, Netscape does cache it but many times when I use the BACK button i get the dreaded:
Data Missing, This document resulted from a POST operation and has expired...

Is there something I'm doing wrong?  And can you tell me after the expired header has been set any subsequent POST method calls to that same CGI script (ie. I am trying to submit some new chunk of data to the script) will result in the cache being called up?

Thanks!

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Ever wondered how to display how many visitors you have online. In this tutorial I will show you an easy but effective way to display the number of online visitors in WhizBase. In this article I assume you have read my previous articles and know …
Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

821 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