Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Ignore: ASP.Net locking file after FileInfo.CopyTo

Back to Forum: Tech Off
  • User profile image
    Rossj

    I've got a little bit of code the copies a file to a new location, but once the file has been copied it maintains a handle on the file (meaning I can't delete it) for a long time after I have copied the file.

    My code looks like the following, and SysInternals handle program has confirmed it is the WP that still has a handle to it.

        FileInfo fileInf = new FileInfo( pathToFile );
        fileInf.CopyTo( destination, true );
        fileInf = null;
    


    Any suggestions? Or should I just copy the file myself?


    UPDATE: Forget it, was being silly, problem was elsewhere.

  • User profile image
    Ion Todirel

    Rossj wrote:
    Forget it, was being silly, problem was elsewhere.
    where?

  • User profile image
    Rossj

    Ion Todirel wrote:
    
    Rossj wrote:Forget it, was being silly, problem was elsewhere.
    where?


    Me using File.OpenRead() as a parameter to MD5 ComputeHash(), which is a silly thing to do as I need to close() the stream created ...

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.