I need to create nested sections in my Web.config file, i can't find any examples that match my requirements.
<IPTests>
<Environment environment="DEV">
<Machine machine="Web01">
<SiteIP site="Sitecore" ip="10.10.2.191">
</SiteIP>
</Machine>
</Environemnt>
</IPTests>
This is used for a "Health Check" for different applications/sites. I need to check all of the resources that different sites use are working. I've done this already using DNS, however i now need to do it in our different environments for our different servers by hitting the different servers with an ip address.
Any help would be great!
This is what i have thus far.
public class IPTests : ConfigurationSectionGroup
{
[ConfigurationProperty("codeEnvironment")]
public CodeEnvironmentSection CodeEnvironment
{
get { return (CodeEnvironmentSection)base.Sections["codeEnvironment"]; }
}
}
public class CodeEnvironmentSection : ConfigurationSection
{
[ConfigurationProperty("environemnt")]
public ValueElement To
{
get { return (ValueElement)base["environemnt"]; }
}
}
public class MachineSection : ConfigurationSection
{
[ConfigurationProperty("machine")]
public ValueElement To
{
get { return (ValueElement)base["machine"]; }
}
}
public class SiteIPSection : ConfigurationSection
{
[ConfigurationProperty("site")]
public ValueElement To
{
get { return (ValueElement)base["site"]; }
}
[ConfigurationProperty("ip")]
public ValueElement To
{
get { return (ValueElement)base["ip"]; }
}
}
public class ValueElement : ConfigurationElement
{
[ConfigurationProperty("value")]
public string Value
{
get { return (string)base["value"]; }
set { base["value"] = value; }
}
}