Cannot delete file from webserver...... process cannot access style error

  • Thread starter news.microsoft.com
  • Start date
N

news.microsoft.com

I need some help here guys.... i have been simply trying to delete a file
from the webserver using asp.net

using the following code.

System.IO.File.Delete(FullPath);
however the error message i get is the following

The process cannot access the file
"e:\inetpub\wwwroot\client_dev\brands\Product_images\1450.jpg" because it is
being used by another process.

What other process could be doing this? it is happening both on our dev box
AND up at our host...

in code i do not have any references to the file at all.... so there couldnt
be any locks that i am causing intentionally....

what else could lock a file.... and if so how can i remove the lock so i can
DELETE the file..
 
A

Axel Dahmen

Is it possible that some other of your web pages is just showing this
picture, so that there's a lock caused by that?

HTH,
Axel Dahmen
 
V

vMike

news.microsoft.com said:
I need some help here guys.... i have been simply trying to delete a file
from the webserver using asp.net

using the following code.

System.IO.File.Delete(FullPath);
however the error message i get is the following

The process cannot access the file
"e:\inetpub\wwwroot\client_dev\brands\Product_images\1450.jpg" because it is
being used by another process.

What other process could be doing this? it is happening both on our dev box
AND up at our host...

in code i do not have any references to the file at all.... so there couldnt
be any locks that i am causing intentionally....

what else could lock a file.... and if so how can i remove the lock so i can
DELETE the file..
There is a good chance you have some unmanaged code that is opening the file
but not closing/disposing of it and therefore it is still in use. You need
to call the close or dispose method. Asp does not manage file operations in
many cases.

Mike
 
D

Derek Harmon

news.microsoft.com said:
what else could lock a file.... and if so how can i remove the lock

If the dev box is XP, try opening a command prompt and running

openfiles /?

You need to activate it and re-boot, but this utility can be helpful
diagnosing what process is keeping the file(s) open. Other third-
party GUI tools exist that provide similar functionality.


Derek Harmon
 
G

Guest

I would like to know, whether you're uploading that File using
HTTPPost.SaveAs Method?
 

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,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top