using System.Security.AccessControl;
FileSystemAccessRule faRule;
FileSystemRights fsrRights;
fsrRights = FileSystemRights.FullControl;
faRule = new FileSystemAccessRule(
new NTAccount("DOMAIN\\user"),
fsrRights,
InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit,
PropagationFlags.InheritOnly, AccessControlType.Allow
);
//security.AddAccessRule(faRule);
//File.SetAccessControl(txtFile.Text, security);
DirectorySecurity dirsec = Directory.GetAccessControl(@"\\server\sub$\folder");
dirsec.AddAccessRule(faRule);
Directory.SetAccessControl(@"\\server\sub$\folder", dirsec);
No comments:
Post a Comment