Your SAS programs, embedded in web apps and elsewhere

Stored Process - Web output - preventing cacheing of results

Reply
N/A
Posts: 0

Stored Process - Web output - preventing cacheing of results

I have two stored processes, both use ODS and produce HTML output.
The first process contains a submit button on the output which calls
the second. The second process contains a back button which I want to
use to return to the first process and rerun it.

My problem is that the results from the first process are cached in
the browser (IE6) and I want the first stored process to trigger again
and produce fresh output.


How can I achieve this?


I have tried using HTTP meta tags in the header (expires and pragma)
but this doesn't appear to be working.


Does the execute method make a difference; POST or GET?
SAS Super FREQ
Posts: 8,743

Re: Stored Process - Web output - preventing cacheing of results

HI:
I don't really think that GET or POST are the culprit here. I thought that the expires and pragma would work. Are you setting these with the STPSRV_HEADER function?

Here's an example:
http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/httphead.html

If this is what you're trying (from the above example page) and it is not working, then you should open a track with Tech Support.

cynthia

Example code:
You can set any HTTP record for your stored process output by calling the STPSRV_HEADER function. The following DATA step function calls generate the previous example header records:

old = stpsrv_header("Content-type",
"text/html; encoding=utf-8");
old = stpsrv_header("Expires",
"Wed, 03 Nov 2004 00:00:00 GMT");
old = stpsrv_header("Pragma", "nocache");
N/A
Posts: 0

Re: Stored Process - Web output - preventing cacheing of results

Hi Cynthia,

Thanks for the reply. This is my code:



*ProcessBody;

%global _debug _odsoptions _odsstyle;

data _null_;
length rc1-rc3 $200;
rc1 = stpsrv_header('Expires','Thu, 18 Nov 1999 12:23:34 GMT');
rc2 = stpsrv_header('Cache-Control','no-cache,no-store');
rc3 = stpsrv_header('Pragma','no-cache');
put rc1= rc2= rc3=;

run;

%stpbegin;

<< sas code >>

%stpend;

And this is the first few lines of the HTML source file







SAS Output
N/A
Posts: 0

Re: Stored Process - Web output - preventing cacheing of results

As it turns out the functions are working, It was just that I was looking for evidence of this in the wrong place. The header statements do not appear in the page source, but I think are actually some kind of 'server header'. If I supply the &_debug=trace option I can see them being written out under 'Getting return headers'.

The issue is that now upon going 'back' to the page IE6 reports that it has expired and does not automatically refresh it.

Anyone know if it's possible to get the page to be automatically resubmitted?

Many thanks.
SAS Super FREQ
Posts: 8,743

Re: Stored Process - Web output - preventing cacheing of results

Hi:
You'll have to check with Tech Support on this -- but I think that you might have to reissue the original URL to run the SP again -- in order to get back to the execution page again.

Web pages and HTML generally work on the "request/response" model. The browser makes a request (run an SP); then the server responds (sends the results) -- at this point, one cycle of request/response has finished. It is now up to the browser to make another request. I'm confused though....if the browser is holding the SP results, where would the "BACK" button take the user???

The STPSRV_HEADER functions only apply to the SP results as they come down the "virtual pipeline" between the server and the client. If you are trying to get back to the page that invoked the SP -- and it was the SPWA (stored process web application) execution page -- you'll have to check with Tech Support whether there's a way to get back to the execution page without reinvoking the URL: http://SASStoredProcess/do?

cynthia
Ask a Question
Discussion stats
  • 4 replies
  • 247 views
  • 0 likes
  • 2 in conversation