C#设置文件夹权限,处理为Everyone所有权限
? ? ? ? /// <summary>
? ? ? ? /// 設(shè)置文件夾權(quán)限,處理為Everyone所有權(quán)限
? ? ? ? /// </summary>
? ? ? ? /// <param name="foldPath">文件夾路徑</param>
? ? ? ? public static void SetFileRole(string foldPath)
? ? ? ? {
? ? ? ? ? ? DirectorySecurity fsec = new DirectorySecurity();
? ? ? ? ? ? fsec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.FullControl,
? ? ? ? ? ? ? ? InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow));
? ? ? ? ? ? System.IO.Directory.SetAccessControl(foldPath, fsec);
? ? ? ? }
?
總結(jié)
以上是生活随笔為你收集整理的C#设置文件夹权限,处理为Everyone所有权限的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Android studio中如何调用s
- 下一篇: C# graphics方法