using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.DirectoryServices; publicpartialclass _Default : System.Web.UI.Page ...{ protectedvoid Page_Load(object sender, EventArgs e) ...{ //注意网站 与 虚拟目录的属性不一样的 path不同 DirectoryEntry dir =new DirectoryEntry("IIS://localhost/w3svc"); foreach (string elmentName in dir.Properties.PropertyNames) ...{ PropertyValueCollection valueCollection = dir.Properties[elmentName]; for (int i =0; i < valueCollection.Count; i++) ...{ this.Response.Write(elmentName +"["+ i.ToString() +"] ="+ valueCollection[i].ToString() +"<br/>"); } } } }