Using System.DirectoryServices to Configure IIS
This section describes how to use the .NET System.DirectoryServices namespace to configure IIS programmatically in managed code. The System.DirectoryServices namespace provides access to the IIS ADSI provider classes, methods, and properties.
System.DirectoryServices can be used to get and set String and DWORD properties in the IIS metabase, and invoke most methods. However, you cannot perform the following tasks unless you are using Windows XP Professional with Service Pack 2 or Windows Server 2003 with Service Pack 1. Doing so results in errors like "The directory cannot report the number of properties":
Enumerating through a collection of properties
Setting binary properties
Adding entries to a property collection
Deleting entries from a property collection
Moving or copying metabase nodes
Configuring MIME types or IP security properties
This section includes the following topics that contain example code to configure IIS using System.DirectoryServices.