遍历DIRECTORY属性 OBJECT

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;
public partial class _Default : System.Web.UI.Page
{
    
protected void 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/>");
}

}


    }

}
posted @ 2007-08-24 15:11  Benny Ng  阅读(323)  评论(0)    收藏  举报