title: DirectorySecurity sets Special Permissions while FileSecurity does not
body: <p>Examine the following two blocks of code:</p>
  
  <pre><code>System.Security.AccessControl.DirectorySecurity dsec = System.IO.Directory.GetAccessControl(str);
  System.Security.Principal.NTAccount group= new System.Security.Principal.NTAccount("DOMAIN","USERGROUP");
  System.Security.AccessControl.FileSystemAccessRule myrule = new System.Security.AccessControl.FileSystemAccessRule(group,System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.AccessControlType.Allow);
  dsec.SetAccessRule(myrule);
  System.IO.Directory.SetAccessControl(str,dsec);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>System.Security.AccessControl.FileSecurity fsec = System.IO.File.GetAccessControl(file);
  System.Security.Principal.NTAccount group= new System.Security.Principal.NTAccount("DOMAIN","USERGROUP");
  System.Security.AccessControl.FileSystemAccessRule myrule = new System.Security.AccessControl.FileSystemAccessRule(group,System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.AccessControlType.Allow);
  fsec.SetAccessRule(myrule);
  System.IO.File.SetAccessControl(file,fsec);
  </code></pre>
  
  <p>One would expect them both to do the exact same thing, only one to a directory and one to a file. And, in some ways, they do. In both cases, the filesystem object in question changes such that DOMAIN\USERGROUP has the Effective Permissions of Full Control.</p>
  
  <p>However, the strange part is, when you right click on a file and view security, you see this:
  <img src="https://i.stack.imgur.com/XkGMr.png" alt="File Security Tab"></p>
  
  <p>and when you right click on a folder and view security, you see this:
  <img src="https://i.stack.imgur.com/DG2Ex.png" alt="Folder Security Tab"></p>
  
  <p>If I then go to Advanced->Effective Permissions->Select(DOMAIN\USERGROUP), it shows that the effective permissions for the folder, for that group, is Full Control (All of the boxes are checked, not just the Full Control Box. That would be even weirder).</p>
  
  <p>My question is, why is there a difference in the effect of an almost identical implementation and does anyone know how to replicate the effect of applying permissions to Files?</p>