C#指定某用户对某文夹件的访问权限

      using System.Security.AccessControl;

//设置myFloder文件夹的iis访问权限
                string userAccount = @"IIS_IUSRS";
                string filePath = @"C:\inetpub\myFloder";
                DirectorySecurity dSecurity = Directory.GetAccessControl(filePath,
                        AccessControlSections.All);

dSecurity.AddAccessRule(new FileSystemAccessRule(userAccount,
                                       FileSystemRights.FullControl,
                                       InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
                                       PropagationFlags.None,
                                       AccessControlType.Allow));
                Directory.SetAccessControl(filePath, dSecurity);

上一篇:linux下一些可用库


下一篇:ffmpag总结_android_to_ios视频转换