if (File.Exists(destFileName))
{
try
{
FileInfo fileInfo = new FileInfo(destFileName);
System.Security.AccessControl.FileSecurity fileSecurity = fileInfo.GetAccessControl();
fileSecurity.AddAccessRule(new System.Security.AccessControl.FileSystemAccessRule("Everyone", System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.AccessControlType.Allow));
fileSecurity.AddAccessRule(new System.Security.AccessControl.FileSystemAccessRule("Users", System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.AccessControlType.Allow));
fileInfo.SetAccessControl(fileSecurity);
fileInfo.Attributes = FileAttributes.Normal;//this is the real issue
fileInfo.Delete();
//File.Delete(destFileName);
}
catch (Exception ex)
{
}
}