Configuration
  Write Client Configuration
  Retrieve Configuration
  Custom Config Handler

Get URL for this page

How Do I... Write client configuration files?

In addition to supporting access to configuration settings from within an ASP.NET Web Application Server, the ASP.NET configuration system also enables client-side exe applications to obtain access to configuration data at runtime. The API you do this through - System.Web.Configuration.ConfigurationSettings - is the same as that for Web scenarios. There are, however, four differences:
  1. The root configuration file for client side exe configuration access -- Machine.config -- is the same as that for Web scenarios. However, the application-specific configuration data is not stored in files named Web.Config, but rather in XML text files whose name matches the host exe that launched the client process (note that the file format is identical to Web.Config).

    For example, a client exe "MySample.exe" would store its application-specific configuration data within the MySample.exe.config file stored in the same directory as the launching exe. Note that because the configuration file name matches the name of the client exe, it is possible to store multiple exe applications (along with their appropriate configuration data) within the same file system directory.

  2. Client-side exes can only store configuration data in one of two files: Machine.config and the application-specific configuration data file (for example, MySample.exe.config). The ASP.NET configuration system will not examine sub-directories beneath the .exe for configuration data. Nor will it look at any parent directory configuration.

    For example, here is the configuration resolution path mentioned for the above MySample.exe:

        C:\Program Files\Microsoft .NET Framework 2.0\Machine.config	<= Base Configuration Settings for Machine
        D:\MyApplication\MySample.exe.config	   	<= Overriden by Application Config Settings
        
  3. The location tag directive is not enabled or used for client exe scenarios. This is only available for use in Web application scenarios.

  4. Changes to the originating configuration file are not automatically picked up by the ASP.NET configuration system. Instead, a client exe must stop and re-launch the exe application in order for changes to the configuration files to take effect.

For more information on the configuration file format, see the ASP.NET Configuration File Format pages.

For information on retrieving configuration information, refer to the ASP.NET section on Retrieving Configuration Information


Copyright 2001-2002 Microsoft Corporation. All rights reserved.