Hi, i'm trying to create a simple windows form tree (c# 3.5) like IIS that show Sites/Virtual Directory/Applications/Folder/Files.
I have to do this for Win2003/Vista/Win2008/Win7 (iis 6 and 7).
I have some problems to show all folder.
For example this simple code not discover physical directories.
static void Main(string[] args)
{
DirectoryEntry dir = new DirectoryEntry("IIS://Localhost/W3SVC/1/Root");
Expand(dir);
}
private static void Expand(DirectoryEntry entry)
{
foreach (DirectoryEntry child in entry.Children)
{
Console.WriteLine("{0} [{1}]", child.Name, child.SchemaClassName.ToString());
Expand(child);
}
}
My idea is:
1) list all site
2) on "beforeExpand" event create nodes for each virtual directory
3) on "beforeExpande" of a virtual directory create nodes for virtual directories and folder and files
Can you help me?