Custom Configuration management for app.Config

S

Shaun

Hi,
I created a custom Section handler using System.configuration for Web
application to read from Web.Config File.

If I want to use the same handler to read from app.config file:
app.config is not interpreted as XML file, & the code breaks.

Here is the sample of the logic.

For Each node In section.ChildNodes
For Each element In node.ChildNodes
elementKey = element.GetAttribute("key")
elementValue = element.GetAttribute("value")
Next
Next

Kindly let me know how to use the same custom handler to read from
web.config as well as app.config file.

Thanking you
Shaun
 
J

John Saunders

Shaun said:
Hi,
I created a custom Section handler using System.configuration for Web
application to read from Web.Config File.

If I want to use the same handler to read from app.config file:
app.config is not interpreted as XML file, & the code breaks.

app.config _is_ an XML file. What makes you think it isn't?

Do you mean that the <program>.exe.config in the output directory (e.g.,
bin\Release) is not an XML file?
 
S

Shaun Ram

I did not mean that app.config is not a XML File, but then the
constraint is, in case of Web.Config file the XML DOM ignores white
space by default, but in case of app.config, white space is recognized &
I want to know how you ignore whiteSpace. You could if you are actually
loading the XMLDocument, but then using getConfig method I need to
ignore white space.

Shaun
 
S

Shaun Ram

I did not mean that app.config is not a XML File, but then the
constraint is, in case of Web.Config file the XML DOM ignores white
space by default, but in case of app.config, white space is recognized &
I want to know how you ignore whiteSpace. You could if you are actually
loading the XMLDocument, but then using getConfig method I need to
ignore white space.

Shaun
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top