To read the web.config file, use the code snippet given
below.
Listing 15
System.Configuration.Configuration wConfig =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration ("/joydip");
Later, you can even save the web.config file to another
location in your disk using the code snippet illustrated below.
Listing 16
mConfig.SaveAs ("C:\\wConfig.xml");
You can read the machine.config file using the code snippet
shown below.
Listing 17
System.Configuration.Configuration mConfig =
System.Web.Configuration.WebConfigurationManager.OpenMachineConfiguration ();
Later, you can even save the machine.config file to another
location in your disk using the code snippet illustrated below.
Listing 18
mConfig.SaveAs ("C:\\mConfig.xml");