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?