Can anyone help me with how to update the system.diagnostics section of an application configuration file?
Specifically I want to be able to update the trace switch levels held in the config file from code.
Here is the format of the app.config:
I want to be able to update the TsMain and TsInit trace levels from code using the System.Configuration namespace rather than directly manipulating the xml through code.
I tried:Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ConfigurationSection systemDiagnostics = config.GetSection("system.diagnostics");
But I cannot access the key value pairs for the switches. What I want to do is something like:
systemDiagnostics.Switches.Key["TsMain"].Value = 2;
Any help with this greatfully received.
Andy WebsterPosted Jan 20, 2012, 2:53 AM
Dhaval PatelPosted Jan 20, 2012, 12:14 AM
Please refer below link
http://www.codeproject.com/KB/cs/CustomConfigurationSectio.aspx
http://forums.asp.net/t/1003075.aspx/1
Thanks
Dhaval Patel
This post help you than Mark As Accepted Answer