1 void Main() 2 { 3 using (ServerManager serverManager = new ServerManager()) 4 { 5 var config = serverManager.GetWebConfiguration("SGSM"); 6 ConfigurationSection defaultDocumentSection = config.GetSection("system.webServer/defaultDocument"); 7 defaultDocumentSection["enabled"] = true; 8 ConfigurationElementCollection filesCollection = defaultDocumentSection.GetCollection("files"); 9 ConfigurationElement addElement = filesCollection.CreateElement("add"); 10 addElement["value"] = @"myhome.html"; 11 filesCollection.AddAt(0, addElement); 12 13 serverManager.CommitChanges(); 14 } 15 16 using (ServerManager serverManager = new ServerManager()) 17 { 18 var webConfig = serverManager.GetWebConfiguration("SGSM"); 19 var section = webConfig.GetSection("system.webServer/defaultDocument"); 20 21 foreach (ConfigurationElement item in section.GetCollection("files")) 22 { 23 var x = item["value"]; 24 Console.WriteLine(x); 25 } 26 } 27 } 28 29 // Define other methods and classes here