我从以下代码中获取了一个重复的FileSystemAccessRule:
C:\inetpub\wwwroot\AspInfo\Account
BUILTIN\IIS_IUSRS : Allow : ReadAndExecute, Synchronize
BUILTIN\IIS_IUSRS : Allow : -1610612736
NT SERVICE\TrustedInstaller : Allow : FullControl
NT SERVICE\TrustedInstaller : Allow : 268435456
Run Code Online (Sandbox Code Playgroud)
而我无法弄清楚它是什么或为什么.
并且显示的权限与我可以看到的文件FileManager属性不匹配.例如,如何从此迭代或类似迭代中找到"列出文件夹内容"权限.如果有人知道.NET文档中的示例,那将会有所帮助.
protected void directoryInfo()
{
var di = new DirectoryInfo(Server.MapPath("/"));
foreach (DirectoryInfo dir in di.GetDirectories())
{
Response.Write(dir.FullName + "<br/>");
DirectorySecurity ds = dir.GetAccessControl();
foreach (FileSystemAccessRule fsar in ds.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount)))
{
string userName = fsar.IdentityReference.Value;
string userRights = fsar.FileSystemRights.ToString();
string userAccessType = fsar.AccessControlType.ToString();
Response.Write(userName + " : " + userAccessType + " : " …Run Code Online (Sandbox Code Playgroud)