Hy, is there any posibillities to restrict acces to a folder stored on an sd card? I tried this but it doesn't work...Any ideas are welcome. Thanks...
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);
}
Try using the
File.Encrypt
andFile.Decrypt
methods. You can use recursion to encrypt directories, by encrypting all files in them.