Say, I have the \"Site Name\" web site in the IIS. I can access most of its functions via the ServerManager class from my C# code. What I can\'t seem to figure out is how to
Try this:
using (Microsoft.Web.Administration.ServerManager sm = Microsoft.Web.Administration.ServerManager.OpenRemote("localhost"))
{
int counter = 0;
string[] ipAddress = new string[10];
string[] sites = new string[10];
List> mylist = new List>();
foreach (var site in sm.Sites)
{
sites[counter] = site.Name;
foreach(var bnd in site.Bindings)
ipAddress[counter] = bnd.EndPoint != null ?
bnd.EndPoint.Address.ToString() : String.Empty;
mylist.Add(Tuple.Create(sites[counter], ipAddress[counter]));
counter++;
}
}