tags:

views:

1153

answers:

2

Hi

I'm new to accessing IIS 6.0 using C# code. I'm using DirectoryEntry to set properties in IIS, but would like to have better understandig of what properties that I can access, and how.

So if any of you have experiance using DirectoryEntry to access IIS 6.0, and know of a propertie list or a good staring point, can you help a new guy out?

+3  A: 

You can find a list of all MetaBase properties here. Note not all properties apply to all object types, the property documentation lists the object types that the property applies to.

If you look here, you can see a list of all the object types applicable to IIS and each lists which properties are valid for the type and here you can see the structure for object types containing other object types.

AnthonyWJones
A: 

The following code may be used to retrieve properties for your case...

DirectoryEntry dir = new DirectoryEntry("IIS://localhost/W3SVC/" + siteid + "/root");
        foreach (string elmentName in dir.Properties.PropertyNames)
        {
            PropertyValueCollection valueCollection = dir.Properties[elmentName];
            for (int i = 0; i < valueCollection.Count; i++)
            {

                HttpContext.Current.Response.Write(elmentName + "[" + i.ToString() + "] =" + valueCollection[i].ToString() + "<br/>");
            }
        }

.

Steve Johnson