best timing for clean the session variables

Discussion in 'ASP General' started by c676228, Apr 26, 2007.

  1. c676228

    c676228 Guest

    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
    c676228, Apr 26, 2007
    #1
    1. Advertising

  2. 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.
    Steven Cheng[MSFT], Apr 27, 2007
    #2
    1. Advertising

  3. c676228

    c676228 Guest

    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/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.
    >
    >
    >
    >
    >
    c676228, Apr 30, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    1
    Views:
    442
    Natty Gur
    Jul 8, 2003
  2. Replies:
    8
    Views:
    510
  3. dorayme
    Replies:
    0
    Views:
    411
    dorayme
    Dec 27, 2010
  4. Singapore Computer Service

    Re: Best way to clean html coding

    Singapore Computer Service, Dec 27, 2010, in forum: HTML
    Replies:
    0
    Views:
    426
    Singapore Computer Service
    Dec 27, 2010
  5. Allodoxaphobia

    Re: Best way to clean html coding

    Allodoxaphobia, Dec 27, 2010, in forum: HTML
    Replies:
    0
    Views:
    474
    Allodoxaphobia
    Dec 27, 2010
Loading...

Share This Page