FileUpload, Wizard, and saving the data

Discussion in 'ASP .Net Web Controls' started by David Thielen, May 2, 2006.

  1. Hi;

    I have a 2 page wizard and on page 0 I have a FileUpload control. In my
    OnNextButtonClick for page 0 I need to read in the file because that stream
    is gone when the user clicks Finish on page 1.

    What is the recomended way to do this? The best I have come up with is to
    read it in to a byte[] and attach that to the session. (I have session data
    stored on the server, not as hidden data on the client page.)

    I thought of saving it as a temp file - but how do I get the file deleted if
    they never click Finish or Cancel? I don't want a boatload of abondened files
    building up in the temp directory.

    --
    thanks - dave
    david_at_windward_dot_net
    http://www.windwardreports.com
     
    David Thielen, May 2, 2006
    #1
    1. Advertising

  2. Hi Dave,

    Thank you for posting.

    As for the fileuploading during one of the wizard steps on page, based on
    my understanding, we have to persiste the file temporarly on the
    server-side. And currently the available options have:

    1. temp file
    2. Session State
    3. Application Cache,
    4. using temp db table in database(sqlserver)

    And using SessionState or Application Cache will consume the server
    process's memory and will hit performance when there is large requests on
    such pages. However, the advantage is that SessionState data will expire
    after session timeout. And for Application cache, we can set Timeout
    dependency so that the certain cache item will be expired and removed after
    a specified period.

    For temp file, the main problem is the temp folder cleaning up as you've
    mentioned. I think you can consider creating a background thread in the
    ASP.NET application which timely monitor the temp folder and delete those
    old/expired files. The rule to determine the expired files can depend on
    file attrubutes or your custom timestamp info embeded in the temp file's
    filename.

    Just some of my opinions. Hope this helps.

    Regards,

    Steven Cheng
    Microsoft Online Community Support


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

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

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


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



    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], May 3, 2006
    #2
    1. Advertising

  3. Hi;

    On using a temp file, is there an event that occurs when a session expires?
    If so, how can I get that event? I could then delete on expiration.

    I worry about using another thread because there is no way to know if a temp
    file is truly no longer in use. I could set a real long value, like 8 hours -
    but then I have lots of files sitting there that should be deleted already.

    --
    thanks - dave
    david_at_windward_dot_net
    http://www.windwardreports.com



    "Steven Cheng[MSFT]" wrote:

    > Hi Dave,
    >
    > Thank you for posting.
    >
    > As for the fileuploading during one of the wizard steps on page, based on
    > my understanding, we have to persiste the file temporarly on the
    > server-side. And currently the available options have:
    >
    > 1. temp file
    > 2. Session State
    > 3. Application Cache,
    > 4. using temp db table in database(sqlserver)
    >
    > And using SessionState or Application Cache will consume the server
    > process's memory and will hit performance when there is large requests on
    > such pages. However, the advantage is that SessionState data will expire
    > after session timeout. And for Application cache, we can set Timeout
    > dependency so that the certain cache item will be expired and removed after
    > a specified period.
    >
    > For temp file, the main problem is the temp folder cleaning up as you've
    > mentioned. I think you can consider creating a background thread in the
    > ASP.NET application which timely monitor the temp folder and delete those
    > old/expired files. The rule to determine the expired files can depend on
    > file attrubutes or your custom timestamp info embeded in the temp file's
    > filename.
    >
    > Just some of my opinions. Hope this helps.
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Community Support
    >
    >
    > ==================================================
    >
    > When responding to posts, please "Reply to Group" via your newsreader so
    > that others may learn and benefit from your issue.
    >
    > ==================================================
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
     
    David Thielen, May 3, 2006
    #3
  4. Thanks for response Dave,

    As for SessionState, there does exists an built-in Session OnEnd event
    which is triggered when a certain session is abandoned or expired.

    #Session-State Events
    http://msdn2.microsoft.com/en-us/library/ms178583.aspx

    However, this event is only working for In-proc mode session , and there
    has some particular conditions that this event won't fire. Here is an
    ASP.NET faq article whicn has mentioned these things:

    http://www.eggheadcafe.com/articles/20021016.asp

    Hope this helps.

    Regards,

    Steven Cheng
    Microsoft Online Community Support


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

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

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


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



    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], May 4, 2006
    #4
  5. ok - thanks

    --
    thanks - dave
    david_at_windward_dot_net
    http://www.windwardreports.com



    "Steven Cheng[MSFT]" wrote:

    > Thanks for response Dave,
    >
    > As for SessionState, there does exists an built-in Session OnEnd event
    > which is triggered when a certain session is abandoned or expired.
    >
    > #Session-State Events
    > http://msdn2.microsoft.com/en-us/library/ms178583.aspx
    >
    > However, this event is only working for In-proc mode session , and there
    > has some particular conditions that this event won't fire. Here is an
    > ASP.NET faq article whicn has mentioned these things:
    >
    > http://www.eggheadcafe.com/articles/20021016.asp
    >
    > Hope this helps.
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Community Support
    >
    >
    > ==================================================
    >
    > When responding to posts, please "Reply to Group" via your newsreader so
    > that others may learn and benefit from your issue.
    >
    > ==================================================
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    >
     
    David Thielen, May 4, 2006
    #5
  6. You're welcome!

    Regards,

    Steven Cheng
    Microsoft Online Community Support


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

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

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


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



    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], May 4, 2006
    #6
    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. Replies:
    0
    Views:
    641
  2. nicknack

    FIleUpload and file name saving

    nicknack, Jan 15, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    353
    Saber
    Jan 15, 2007
  3. Andy B
    Replies:
    0
    Views:
    466
    Andy B
    Apr 19, 2008
  4. Bogdan
    Replies:
    1
    Views:
    556
    Peter Bucher [MVP]
    May 31, 2008
  5. Rob

    Saving progress in asp.net wizard

    Rob, Oct 9, 2007, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    220
Loading...

Share This Page