Delete File

R

Reggie

Hi & TIA! I have a process that uploads an excel file to a folder in my
site. The file is read and added to a table in my sql server database which
uses this imported list to do a search against one of my tables. The
problem I'm having is once the file is uploaded it gets locked by what
appears to be the aspnet_wp. This causes a problem when the user decides to
alter the excel file to change the list being imported and keeps the same
file name. When this happens the existing file cannot be deleted/removed
because it is locked. I've used everything programmatically to release all
references to the file object. Even if I shut the browser down I cannot
manually delete the file for some time until the aspnet_wp lets it go. I
know of some tools that can be used to unlock the file, but I need to do it
via code. Is this possible and if so where can I find info? Thanks for
your time.
 
M

Michael Nemtsev [MVP]

Hello Reggie,

seems that u didn't dispose the file correctly when u opened it, or there
are some pages which still use it

---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour
:: http://twitter.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


R> Hi & TIA! I have a process that uploads an excel file to a folder in
R> my site. The file is read and added to a table in my sql server
R> database which uses this imported list to do a search against one of
R> my tables. The problem I'm having is once the file is uploaded it
R> gets locked by what appears to be the aspnet_wp. This causes a
R> problem when the user decides to alter the excel file to change the
R> list being imported and keeps the same file name. When this happens
R> the existing file cannot be deleted/removed because it is locked.
R> I've used everything programmatically to release all references to
R> the file object. Even if I shut the browser down I cannot manually
R> delete the file for some time until the aspnet_wp lets it go. I know
R> of some tools that can be used to unlock the file, but I need to do
R> it via code. Is this possible and if so where can I find info?
R> Thanks for your time.
R>
 
R

Reggie

WBR, Thanks for the advice. You were correct in that I missed an object
that was holding onto the file. Sorry didn't get back sooner. Been out of
town. Thanks again!
 

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,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top