Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check if file is in use
Message
De
22/11/2009 20:29:33
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Check if file is in use
Divers
Thread ID:
01436112
Message ID:
01436112
Vues:
100
I am trying to check if a file is in use. The below code works, but after I run it the first time, it locks the file so that it always returns that the file is in use.

How do I check if the file is in use but also not keep the file open after I check?
            try
            {
                File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.None);
            }
            catch (Exception exp)
            {
                return true;
            }
            return false;
Thanks,

Jerry
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform