In ASP.NET, when creating a custom config section, how do I limit the number of a particular section that can be declared?
For example, if in web.config, I repeat the appSettings section...
<appSettings />
<appSettings />
...I get an exception when the configuration loads.
If I do the same with my section...
<employer />
<employer />
...it allows it, but I don't want it to.
My section code (C#) looks like this:
[ConfigurationProperty("employer", IsRequired = true)]
public EmployerElement Employer
{
get
{
return (EmployerElement)this["employer"];
}
set
{ this["employer"] = value; }
}
Any help appreciated, thanks.