I would like to use my own custom XML format in my Web.config. In .Net 1.1 I was using IConfigurationSectionHandler combined with XmlSerializer. Because IConfigurationSectionHandler is depreciated, I want to do the same with ConfigurationSection. I tried it like this:
protected override void DeserializeSection(System.Xml.XmlReader reader)
{
// my custom code to deserialize data from reader
}
If I start my application, I get a Parser Error saying: "Unrecognized configuration section mySection/customChildNode". This happens before DeserializeSection is called. What am I doing wrong? Any hint how to use custom xml in a ConfigurationSection?
Edit: a bit mor code as requested
I tried to implement my section like this:
public class MySection : ConfigurationSection
{
protected override void DeserializeSection(XmlReader reader)
{
// my code
}
}
and register it in the Web.config like this:
<sectionGroup name="mySection" type="myNamspace.MySection, myAssembly"/>
then I try to use it like this:
<mySection>
<abc><xx/></abc>
</mySection>
I would assume that the DeserializeSection of my ConfigurationSection is called and the passed in XmlReader allows access to the contained custom XML. But DeserializeSection is not called and a get an error saying that mySection/abc is unknown.