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

Discussion in 'ASP .Net' started by news.microsoft.com, Jan 8, 2005.

  1. 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..
     
    news.microsoft.com, Jan 8, 2005
    #1
    1. Advertising

  2. news.microsoft.com

    Axel Dahmen Guest

    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" <> schrieb im Newsbeitrag
    news:#...
    > 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..
    >
    >
     
    Axel Dahmen, Jan 8, 2005
    #2
    1. Advertising

  3. news.microsoft.com

    vMike Guest

    "news.microsoft.com" <> wrote in message
    news:%...
    > 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
     
    vMike, Jan 8, 2005
    #3
  4. news.microsoft.com

    Derek Harmon Guest

    "news.microsoft.com" <> wrote in message news:%...
    > 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
     
    Derek Harmon, Jan 8, 2005
    #4
  5. RE: Cannot delete file from webserver...... process cannot access styl

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

    "news.microsoft.com" wrote:

    > 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..
    >
    >
    >
     
    =?Utf-8?B?Q2hpbm1heQ==?=, Jan 10, 2005
    #5
    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.

Share This Page