I am currently trying to implement a Custom Configuration Section in a project I am busy with and no matter what I try I keep getting the error below:
{\"An error occurr
My guess is that you've copied the code, but you have different assembly names. Posting the config will help.
I would also fully quality your type in the config (something that sample doesn't show). Something like...
<section name="MySection" type="My.Assembly.Type, My.Assembly" />
So it turns out that when you create a project in Visual Studio, it automatically defines a root namespace (the name of the project by default) for the project. Thus you must include that root namespace in the section type as well as any custom namespaces you defined within your settings class.
For example, in the case of the original poster a working configuration for them may have looked something like this:
<section name="MySection" type="ROOT_NAMESPACE.Samples.AspNet.PageAppearanceSection, NAME_OF_ASSEMBLY" />
Where ROOT_NAMESPACE and NAME_OF_ASSEMBLY are defined in the project properties as shown in this snapshot of my project.
In my particular case, I did not explicitly define namespaces in my project. Thus my section configuration setting just had the root namespace, the name of the settings class, and the name of the assembly, as such;
<section name="programSettings" type="ShipmentImport.ProgramSettings, ShipmentImport" />
I know its a couple years late, but I hope it keeps somebody else from spending hours on this like I did.
You should also check out Jon Rista's three-part series on .NET 2.0 configuration up on CodeProject.
Highly recommended, well written and extremely helpful!
Marc
Please try with the following code:
<configSections>
<sectionGroup name="pageAppearanceGroup">
<section name="pageAppearance" type="Samples.AspNet.PageAppearanceSection,Samples.AspNet" allowLocation="true" allowDefinition="Everywhere" />
</sectionGroup> <!-- Other <section> and <sectionGroup> elements. -->
</configSections>
Please try with this
<configSections>
<sectionGroup name="pageAppearanceGroup">
<section name="pageAppearance"
type="Samples.AspNet.PageAppearanceSection,Samples.AspNet"
allowLocation="true"
allowDefinition="Everywhere" />
</sectionGroup>
<!-- Other <section> and <sectionGroup> elements. -->
</configSections>
Thanks, Vedi