[原]C#设置文件夹用户权限

var security = new DirectorySecurity();  
string path=@"C: emp"
//设置权限的应用为文件夹本身、子文件夹及文件,所以需要InheritanceFlags.ContainerInherit 或 InheritanceFlags.ObjectInherit  
security.AddAccessRule(new FileSystemAccessRule("NETWORK SERVICE", FileSystemRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow));  
security.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow));  
Directory.SetAccessControl(path, security);

作者:a497785609 发表于2014-3-18 12:52:25 原文链接
阅读:69 评论:0 查看评论
原文地址:https://www.cnblogs.com/zhangqs008/p/3763846.html