best timing for clean the session variables

best timing for clean the session variables

am 26.04.2007 20:24:01 von bettys

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.
--
Betty

RE: best timing for clean the session variables

am 27.04.2007 09:35:59 von stcheng

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/de fault.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.

RE: best timing for clean the session variables

am 30.04.2007 22:20:02 von bettys

thank you, Steven, for your suggestion. That's definitely dorable
--
Betty


"Steven Cheng[MSFT]" wrote:

> 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/de fault.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.
>
>
>
>
>