0

我的应用程序中有 4 个文件夹,每个文件夹都有一定的权限...

文件夹1里面有文件夹2,文件夹2里面有文件夹3和文件夹4

我可以使用以下代码拒绝从文件夹 2 到文件夹 3 的继承,但我想从文件夹 1 继承到文件夹 3?

我希望文件夹继承 folder1 的所有属性

        string folderpath="xyz";
        string UserAccount = "asp";
        System.IO.DirectoryInfo FolderInfo = new System.IO.DirectoryInfo(folderpath);
        DirectorySecurity FolderAcl = new DirectorySecurity();
        FolderAcl.AddAccessRule(new FileSystemAccessRule(UserAccount,       FileSystemRights.ReadData, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow));
        const bool protectRulesFromInheritance = true;
        const bool preserveInheritance = true;
        FolderAcl.SetAccessRuleProtection(protectRulesFromInheritance, preserveInheritance);
        FolderInfo.SetAccessControl(FolderAcl);
4

1 回答 1

0

你只能从你的父母那里继承。祖父母的继承只是隐含的;也就是说,如果您从您的父母继承,而您的父母从其父母继承,您将拥有隐式祖父母继承。

如果这可能的,管理(内部和用户界面方面)将是可怕的,尤其是在移动文件夹时......

于 2012-07-19T10:52:27.657 回答