Preface:
Data Reading in the custom configuration section. Previously, Xiao Zhu wrote a series of articles.
This article describes how to use program code to write custom configuration data.
Note:
In the Microsoft Visual Studio ide debugging environment, when a program is written to. config.
The program will write * .vshost.exe. config instead of *. EXE. config as expected.
After the program is executed, the IDE overwrites * .vshost.exe. config to the status before writing.
Therefore, the program fails to be executed.
After compilation, click *. EXE under the bin directory for execution.
Check *. EXE. config again to see the expected results.
Related information:
[ASP. NET] write your own configuration section Part 1: http://www.dotblogs.com.tw/regionbbs/archive/2009/05/08/custom_configuration_section_in_web_config.aspx
[ASP. NET] write your own configuration section Part 2: http://www.dotblogs.com.tw/regionbbs/archive/2009/09/17/orgainzeyoursectionintogroupforconfiguration.aspx
[ASP. NET] write your own configuration section Part 3: http://www.dotblogs.com.tw/regionbbs/archive/2009/10/09/customconfigurationelementcollection.aspx
Sample program:
Download file: clk.configurationsample.rar
Custom configurationsection
Set. config
Write Program
Execution result
Postscript:
Custom configuration section,
If the type in the system. Configuration namespace is used as the attribute, it is quite convenient to read and write data.