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

  • Thread starter Thread starter news.microsoft.com
  • Start date 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..
 
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
 
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
 
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
 

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

Back
Top