RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


ASP.NET Configuration and Group Policy, Part 2: Creating and Using Group Policy-Aware Providers

The second installment of this three-article series discusses how to set Windows Group Policy at both the machine and domain levels to control application configuration settings from a central location.

n Article 1 of this series, you saw how to create a custom configuration section in a Web.config file and access it using a custom provider. That solves the problem of where to store configuration information and how to use it in your applications, but it doesn't address another problem mentioned in that article, which is that the ASP.NET configuration system provides no central mechanism for controlling the values in Web.config files. The result is that Web.config files on multiple servers (such as in a web farm) can easily get out of sync. Fortunately, you can solve that by extending your configuration providers to make them Group Policy aware.

Group Policy provides a mechanism for centrally managing Windows features and applications. You can take advantage of Group Policy to create a mandatory and centrally-managed environment for your web applications' configuration settings by creating a custom Group Policy Object (GPO) and building Group Policy awareness into your configuration code.

Of course, you can also create Group Policy-aware code that reads configuration information from the <appSettings> and <connectionStrings> sections of Web.config using the technique shown in these articles. Alternatively, as demonstrated, you can combine the custom configuration provider and Group Policy-aware techniques to make the configuration classes that expose the custom configuration information Group Policy aware.

Working with Group Policy
Windows Group Policy provides a mechanism for applying settings to all the machines within an Active Directory domain or forest, or locally on individual machines. Domain controllers apply each Group Policy Object (GPO) defined within their domain to all the machines in the domain as part of the security policy, storing the values in the registry in either the HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER hive, depending on the definitions in an administrative template (.adm file) installed within Group Policy.

Windows includes several common templates for setting operating system parameters and applying policy to applications such as Internet Explorer. However, you can create your own templates to add custom GPOs to Group Policy, and have these applied throughout the domain, or you can install templates locally that control the settings available to just that machine.

Author's Note: This article describes using Group Policy in a mixed Windows 2000/2003/Vista environment. However, Windows Vista and the forthcoming Windows Vista Server (code-name "Longhorn") introduce several new features for Group Policy, including a wider range of operating system and application default settings, multi-lingual support, and improved GPO management. In Vista,.adm templates are called "Classic Administration Templates;" however, the basic approach is the same as described here. For more details, see the document "Deploying Group Policy Using Windows Vista."

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date