« Previous Next »

Thread: Create a simple IIS Clone (winform)

Last post 07-10-2009 7:10 PM by davcox. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 05-15-2009, 11:21 AM

    • Paolo72
    • Not Ranked
    • Joined on 05-15-2009, 3:14 PM
    • Posts 2

    Create a simple IIS Clone (winform)

    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?

  • 07-10-2009, 7:10 PM In reply to

    • davcox
    • Top 50 Contributor
    • Joined on 07-21-2006, 6:28 PM
    • Redmond
    • Posts 213

    Re: Create a simple IIS Clone (winform)

    Still working on this?

    IIS configuration only knows about web sites and virtual directories, it does not have a list of all the physical folders underneath a particular website or virtual directory.  You'll have to write separate code that for each virtual directory would open the folder, and then list the child folders (and do this recursively).

    Dave

Page 1 of 1 (2 items)
Microsoft Communities