Opening a Configuration File

If you want to open a particular configuration file, you can use one of the Open methods exposed by the WebConfigurationManager class. For example, the page in Listing 34.11 uses the OpenMachineConfiguration() method to open the Machine.config file and display the default value for the authentication mode setting.

Listing 34.11. ShowConfigMachine.aspx

images

You can use the WebConfigurationManager class to display configuration information for other websites located on the same server. For example, the page in Listing 34.12 displays a list of all the virtual directories contained in the default website. You can select a ...

Get ASP.NET 4 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.