Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Check out the FileSecurity class.

 

And some sample code from here:

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("");
}

You'll have to import some stuff at the top so be prepared for that...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...