I want to read custom section from app config and web config in C#. Section contain nested nodes(not key value pair). I have already read it using StreamReader class but the problem is that when I create SQL connection then it give exception like "Bad configuration in config file". So, is there any other way to do it.
Asked
Active
Viewed 242 times
0
-
https://stackoverflow.com/questions/3461418/how-to-get-the-values-of-a-configurationsection-of-type-namevaluesectionhandler – Amit Kumar Singh Sep 05 '17 at 01:41
-
What have you done so far? can you include it? – Vijunav Vastivch Sep 05 '17 at 01:48
-
1. I have read my custom section using StreamReader class but when I try to SqlConnection then it gives "Bad configuration". 2. I have tried to register my section using configSection but not working because I don't have key value pair in my custom section. – AMAR MATHUR Sep 05 '17 at 01:55
1 Answers
0
As far as i knew:
Web.config
or app.config
file depend on System.Configuration dll
if you have wrote any none of that Configuration dll it will return you to an exception error message:
unless you have to create your own xml file and read its content.

Glorfindel
- 21,988
- 13
- 81
- 109

Vijunav Vastivch
- 4,153
- 1
- 16
- 30