0

嗨,有没有办法限制对存储在 SD 卡上的文件夹的访问?我试过这个,但它不起作用......欢迎任何想法。谢谢...

public static void setRight(string dirName,string account, FileSystemRights rights, AccessControlType controlType)
    {
        DirectoryInfo dir = new DirectoryInfo(dirName);

        DirectorySecurity dSecurity = new DirectorySecurity();// Directory.GetAccessControl(dirName);

        // Add the FileSystemAccessRule to the security settings.
        dSecurity.AddAccessRule(new FileSystemAccessRule(account, rights, controlType));

        // Set the new access settings.
        dir.SetAccessControl(dSecurity);
        Directory.SetAccessControl(dirName, dSecurity);

    }
4

1 回答 1

0

尝试使用File.EncryptandFile.Decrypt方法。您可以使用递归来加密目录,方法是加密目录中的所有文件。

于 2012-05-19T16:07:55.940 回答