Folder lock and allow access to specific app

  • Thread starter Thread starter himmodi
  • Start date Start date
H

himmodi

Guest
HI

we want to lock any folder and allow to access through app specific.

I am using this code


string adminUserName = Environment.UserName;
DirectorySecurity dirSecurity = Directory.GetAccessControl(folderPath);
FileSystemAccessRule accessRule = new FileSystemAccessRule(adminUserName, FileSystemRights.FullControl, AccessControlType.Deny);
dirSecurity.AddAccessRule(accessRule);
Directory.SetAccessControl(folderPath, dirSecurity);
// hiding a folder
var dirInfo = new DirectoryInfo(folderPath);
dirInfo.Attributes = FileAttributes.Hidden;
return true;




Can ayone help me on this?

Continue reading...
 
Back
Top