views:

147

answers:

1

For various technical reasons which I won't bore you with here, I need to redeclare a section declaration in the configSections section of an ASP.NET 2.0 application which is configured as a child app of another ASP.NET 2.0 application. This is required so the child application can use a different type (same name, different assembly) for the section implementation.

I have tried using the remove element to remove the parent declaration, but the ASP.NET runtime throws an exception stating that the section is already defined. I have also tried to use the clear element, but that removes ALL declared section elements, including those in machine.config. And if I manually add all the required section elements from machine.config, I still get the same error about the duplicate section.

Is there any way that I can change the declaration of a section element so it will resolve to a different type in the manner that I am trying to achieve here?

+1  A: 

No, I'm not aware of any documented, supported way of doing this. Once a config section has been configured and declared, there's no way to override or clear that definition.

You can do a lot with the .NET 2.0 config system, including "externalizing" config sections into external files - but I haven't ever heard about a method to "unconfigure" a configuration section.

I don't see how you can get this to work - other than the obvious solution: call the section something else in your child app....

marc_s
Yeah, that may be the route I have to take. I am trying to avoid it though, as it would require changes to shared code.
Cleggy