private static FileSecurity GetSecuritySettings() { FileSecurity fileSecurity = new FileSecurity(); fileSecurity.SetAccessRuleProtection(true, false); fileSecurity.AddAccessRule((FileSystemAccessRule)fileSecurity.AccessRuleFactory((IdentityReference) new NTAccount(WindowsIdentity.GetCurrent().Name), -1, false, InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow)); return(fileSecurity); }
static private FileSecurity GetSecuritySettings() { FileSecurity security = new FileSecurity(); security.SetAccessRuleProtection(true, false); security.AddAccessRule( (FileSystemAccessRule)security.AccessRuleFactory( new NTAccount( WindowsIdentity.GetCurrent().Name), // Full control -1, false, InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow)); return(security); }