I need to overwritte Default Site if isnt use, overwrite it if the user decides so or create a new one.
I am trying check all sites, and take this with port 80 and name "Default Web Site". Next if it exist I want to take physical path and check does it equal the default path and contains all files for default path. In this way:
private static void CheckSite(SiteCollection applicationSites)
{
int i = 0;
foreach (var item in applicationSites)
{
foreach (var binding in item.Bindings)
{
int port;
if (binding.EndPoint != null)
port = binding.EndPoint.Port;
else
continue;
if (port == 80 && item.Name == "Default Web Site")
{
var path = item.Applications[i].VirtualDirectories[0].PhysicalPath;
string[] dire = Directory.GetFiles(path);
}
}
i++;
}
}
Is there better way to do this? I am using Microsoft.Web.Administration.