I can search folder permissions using cacls.exe with command prompt and output them to a text file but I need to display the folder permissions within the C# program so that i can use them in strings etc.
Asked
Active
Viewed 178 times
1 Answers
1
DirectorySecurity dSecurity = Directory.GetAccessControl(@"d:\myfolder");
foreach (FileSystemAccessRule rule in dSecurity.GetAccessRules(true, true, typeof(NTAccount)))
{
if (rule.FileSystemRights == FileSystemRights.Read)
{
Console.WriteLine("Account:{0}", rule.IdentityReference.Value);
}
}

enginne
- 11
- 4