FileUpload, Wizard, and saving the data

D

David Thielen

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

Steven Cheng[MSFT]

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.)
 
D

David Thielen

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

Steven Cheng[MSFT]

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.)
 
S

Steven Cheng[MSFT]

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

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top