best timing for clean the session variables

C

c676228

Hi all,
I usually clean the session when the result page is presented to the user.
At this time, say an email confirmation was sent to the user and a pdf file
they can becdownloaded from the result page.
But if the user click the refresh or back button etc. for some reasons, they
pdf file is not available since it created on the fly when the request was
submitted.
So I am thinking about pull pdf file from database, but don't want the
database being hitted everytime the refresh button was clicked or the
requested is resubmitted.
Do you have a simple cache trick in this case?
Thank you.
 
S

Steven Cheng[MSFT]

Hi Betty,

From your description, your ASP page will dynamically generate some PDF
document and write out it to client user based on their submited request.
Currently, you're wondering any good means to reuse those document(without
regenerate or connect database) when the user refreshing or resubmit the
page, correct?

Based on my experience, for such caching functionality in classic ASP, we
have two obvious approachs:

1. use a temp folder to store those temporarily generated pdf files. And
after user submit a request and the PDF got generated, instead of directly
write out the pdf stream in the same request's response stream. You can use
response.redirect to redirect the user to another page(with parameters
indicate which temp pdf stream need to write out), then the user will
always get pdf stream through that particular page. And you can use a
background program to constantly monitor and clean up the temp folder based
on file's creation/modify datetime. And for client user, if they refresh
the page or resubmit same request, you can first check cached temp file, if
exists, directly flush out the cached temp pdf stream.

2. the code logic is the same as #1, however, instead of using a temp file
folder, you can use a temp database/table to store the temporarly generated
PDF stream.

How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top