Here is my problem. I wish I could list all the IIS web site that is hosted locally. And for each I would like to retrieve the site name, the host name ex. ("localhost: 80") and the port number. I can retrieve a lot of information but could not find where is the information on the host name. Thank you very much.
Here my code [c#] :
DirectoryEntry iis = new DirectoryEntry("IIS://" + Environment.MachineName + "/w3svc");
iis = new DirectoryEntry("IIS://" + Environment.MachineName + "/w3svc");
foreach (DirectoryEntry site in iis.Children)
{
if (site.SchemaClassName == "IIsWebServer")
{
Console.Out.WriteLine(site.Name);
//I do not know the name of the property to find the "host"
Console.Out.WriteLine(site.Host); ???
}
}