I have created a custom configuration section like below
<configSections>
</configSections>
<Tabs>
<Tab name="Dashboard" visibility="true" />
<Tab name="VirtualMachineRequest" visibility="true" />
<Tab name="SoftwareRequest" visibility="true" />
</Tabs>
Custom Configuration Section Handler
namespace EDaaS.Web.Helper
{
public class CustomConfigurationHandler : ConfigurationSection
{
[ConfigurationProperty("visibility", DefaultValue = "true", IsRequired = false)]
public Boolean Visibility
{
get
{
return (Boolean)this["visibility"];
}
set
{
this["visibility"] = value;
}
}
}
}
While running the application throws exception Unrecognized configuration section Tabs. How to resolve this?
You need to write a
configuration handlerto parse this custom section. And then register this custom handler in your config file:Now let’s define the corresponding config section:
and now you could access the settings: