FileSecurity sec = new FileSecurity(fileName, AccessControlSections.All);
Debug.WriteLine("owner = " + sec.GetOwner(typeof(NTAccount)));
foreach (FileSystemAccessRule r in sec.GetAccessRules
(true, true, typeof (NTAccount)))
{
Debug.WriteLine(r.AccessControlType); // deny or allow
Debug.WriteLine(r.IdentityReference); // who
Debug.WriteLine(r.InheritanceFlags);
Debug.WriteLine(r.IsInherited);
Debug.WriteLine(r.PropagationFlags);
Debug.WriteLine(r.FileSystemRights); // specific to the file system
Debug.WriteLine("");
}