Is there a way to list all active websites that exist within IIS using c#?
Thanks
Sp
If anyone is intrested i used the following
var files = Directory.GetFiles(directory, "*",SearchOption.AllDirectories);
sizeInBytes = (from file in files let fileInfo = new FileInfo(file) select fileInfo.Length).Sum();
For IIS 7 you can use Microsoft.Web.Administration.dll (C:\Windows\System32\inetsrv) and the following code
var iisManager = new ServerManager();
SiteCollection sites = iisManager.Sites;
Here's an article explaining how this could be done using classes from the System.DirectoryServices namespace as well as the Microsoft.Web.Administration namespace which was introduced with IIS 7.