List virtual hosts : Host : Directory Services C# Examples


C# Examples » Directory Services » Host »

 

List virtual hosts









    
using  System;
using  System.Data;
using  System.DirectoryServices;

public  class  MainClass{

      public  static  void  Main()  {
              DirectoryEntry  directoryEntry1  =  new  DirectoryEntry();
              directoryEntry1.Path  =  "IIS://localhost/W3SVC/1/ROOT";

              foreach(  DirectoryEntry  entry  in  directoryEntry1.Children  )  {
                    if  (  entry.SchemaClassName  ==  "IIsWebVirtualDir"  )  {
                          //Console.WriteLine(  entry.Name  );
                          Console.WriteLine(  entry.Properties[  "Path"  ].Value  );
                    }
              }
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Directory Services
» Host