=> dimasite

IT for(;;) fun!

Posts Tagged ‘web.config’

How to open Web.config?

Posted by Dmitrij Ivanov on October 16, 2010


1. Open machine.config on the local machine.
WebConfigurationManager.OpenMachineConfiguration();

2. Open root web.config on the local machine.
WebConfigurationManager.OpenWebConfiguration(null);

3. Open web.config for the application at the root of the default web site.
WebConfigurationManager.OpenWebConfiguration("/");

4. Open web.config for a subdirectory of the application found at /MyApp.
WebConfigurationManager.OpenWebConfiguration("/MyApp/subdir");

5. Open web.config for an application at the root of another site.
WebConfigurationManager.OpenWebConfiguration("/", "Another Site");

6. Open the <location> tag for a subdirectory at the application level.
WebConfigurationManager.OpenWebConfiguration("/", null, "/subdir");

7. Open machine.config on another computer, using credentials provided.
WebConfigurationManager.OpenMachineConfiguration(null, "remotemachine", "user", "password");

take a look to the link

Advertisements

Posted in ASP .NET | Tagged: , , , , | Leave a Comment »