直接放上源代码 大家看看
<%@ Page Language="C#" Debug="true" Trace="false" ValidateRequest="false" EnableViewStateMac="false" EnableViewState="true" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Security.AccessControl" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Management" %>
<%@ Import Namespace="System.Diagnostics" %>
<%@ Assembly Name="System.Management,Version=2.0.0.0,Culture=neutral,PublicKeyToken=B03F5F7F11D50A3A" %>
<html>
<head><title>.net ACL Searcher (Code By zcgonvh)</title></head>
<body>
<form runat="server" id="chkfrm">
<div style="text-align: center;">
<h3><span style="color: red"></span></h3>
<asp:textbox runat="server" id="iptPaths" height="99" columns="50" textmode="1"></asp:textbox><br />
<asp:checkbox runat="server" id="is_Recusive" text="Recursive detection" checked="true"></asp:checkbox>
<asp:checkbox runat="server" id="is_CheckFile" text="Check file" checked="false"></asp:checkbox>
<asp:checkbox runat="server" id="is_ShowAllUserACL" text="Show all User's ACL" checked="false"></asp:checkbox><br />
<asp:button runat="server" id="docheck" text="Check"></asp:button><br />
<span>If you selected "Recursive detection" option , program will try enum all-SubDirectories in any directory , and get ACL to show.</span><br />
<span>If you selected "Check file" option , program will try enum all-files in any directory , and get ACL to show (maybe slow).</span><br />
<span>If you selected "Show all User ACL" option , program will show all ACL for any file or directory <br />(only show Allowed Execute file of current-user/users/everyone default).</span>
</div>
</form>
<div style="text-align: center;">
<form runat="server" id="retfrm" visible="false">
<asp:button runat="server" id="doret" text="Return"></asp:button>
</form>
</div>
</body>
</html>
<script runat="server">
class ACL
{
private bool _is_ShowAllUserACL = false;
private bool _is_CheckFile = false;
private bool _is_Recusive = false;
private string CurrentUser = "";
public bool ShowAllUserACL { get { return _is_ShowAllUserACL; } set { _is_ShowAllUserACL = value; } }
public bool CheckFile { get { return _is_CheckFile; } set { _is_CheckFile = value; } }
public bool Recusive { get { return _is_Recusive; } set { _is_Recusive = value; } }
public ACL(string[] Paths,bool is_ShowAllUserACL,bool is_CheckFile,bool is_Recusive)
{
CurrentUser = GetCurrentUserName();
ShowAllUserACL = is_ShowAllUserACL;
CheckFile = is_CheckFile;
Recusive = is_Recusive;
foreach (string path in Paths)
{
if (File.Exists(path))
{
GetFileACL(new FileInfo(path));
}
else if (Directory.Exists(path))
{