views:

5

answers:

0

I have the following code to grant account access to some folder:

  • DirectoryInfo info = new System.IO.DirectoryInfo("C:\MyFreeFolder");
  • DirectorySecurity access = info.GetAccessControl();
  • FileSystemAccessRule rule = new FileSystemAccessRule("NETWORK SERVICE", FileSystemRights.FullControl, AccessControlType.Allow);
  • access.AddAccessRule(rule);
  • info.SetAccessControl(access);

that works fine for "C:\MyFreeFolder":

  • right click the folder
  • go to Security tab
  • select the account
  • every checkbox in the "Allow" column is checked.

But if I try to do the same for a folder that was just created to install my Application ("C:\MyApplicationFolder") it get checked only the "Special Permissions" checkbox. If I click "Advanced" it says "Full control" and in the details every checkbox is checked.
I tried even looping through the FileSystemRights enumeration but got the same results.

Again, MyFreeFolder is just a folder I manually created, while MyApplicationFolder is a folder created by the installer. The installer was created by me through Visual Studio

Is something missing to make the first checkboxes appear as checked???

thanks in advance