Overview of ASP.NET Configuration Files
page 4 of 6
by Joydip Kanjilal
Feedback
Average Rating: 
Views (Total / Last 10 Days): 35004/ 165

Opening the web.config and machine.config files

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");

View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-05-22 7:06:00 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search