public static string GetWebRootPath([NotNull] Site site)
{
Assert.ArgumentNotNull(site, "site");
Application apps = site.Applications["/"];
if (apps != null)
{
VirtualDirectory vdirs = apps.VirtualDirectories["/"];
if (vdirs != null)
{
ConfigurationAttribute phpath = vdirs.Attributes["physicalPath"];
if (phpath != null)
{
string value = (string)phpath.Value;
if (!string.IsNullOrEmpty(value))
{
return value;
}
}
}
}
throw new Exception("IIS website " + site.Id + " seems to be corrupted or misconfigured");
}