In this snippet we create a new directory and set the permission of it to Fullcontrol using ACL.
private static void ChangePermissionOfDir() { //Folder DirectoryInfo NewDir = Directory.CreateDirectory(@"C:\Temp\Te21"); DirectorySecurity dSecur = NewDir.GetAccessControl(); FileSystemAccessRule fAccess = new FileSystemAccessRule("Everyone",FileSystemRights.FullControl,AccessControlType.Allow ); dSecur.AddAccessRule(fAccess); NewDir.SetAccessControl(dSecur); }
No comments:
Post a Comment