tags:

views:

22

answers:

1

In IIS 6, I typically used code to query the metabase as in the following:

var entry = new DirectoryEntry("IIS://localhost/W3SVC");
foreach (DirectoryEntry site in entry.Children)
{
// Blah
}

Now in IIS 7, this only functions if IIS 6 compatibility is installed. What I'd really like to do is use the recommended IIS 7 way of doing things.

My question is this. What is the "proper" way to get information from the IIS 7 metabase on a local or remote machine in code without requiring IIS 6 compatibility mode?

A: 

The new way is to use the Microsoft.Web.Administration namespace:

http://msdn.microsoft.com/en-us/library/microsoft.web.administration(VS.90).aspx

Dave Swersky
Thanks! This does retrieve some information, but not all. For example, I can get the site name, page, and log path, but not default documents. Maybe there's an alternate method or some less commonly used feature of Microsoft.Web.Administration that I'm unfamiliar with.
G W