Below is the exception I'm getting from my web service while deleting a Directory
The process cannot access the file 'button.js' because it is being used by another process.
3/22/2013 11:16:51 AM : Exception :The process cannot access the file 'button.js' because it is being used by another process.
Inner Exception :
Stack Trace :
at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive) at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive) at System.IO.Directory.Delete(String path, Boolean recursive) at CRMobileAPI.v5_2.apibridge.downloadcompleted(String userid, String deviceid, String filepathurl) in E:\websites\test.cont.com\CRMobileAPI\v5_2\apibridge.asmx.cs:line 1213
Source :
mscorlib
Here is my code,
if (Directory.Exists(_DirPath))
{
try
{
DirectoryInfo _DirTemp = new DirectoryInfo(_DirPath);
_DirTemp.Delete(true);
}
catch (Exception Ex)
{
clsExHandler.Instance.Write(Ex);
}
}
Note: this exception not only for 'button.js' it varies at time.
How do I get rid of this issue; my logger file stuck with this exception.