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


ASP.NET Configuration and Group Policy, Part 3: Using the Enterprise Library Manageable Configuration Extensions

This last installment of a three-article series discusses how to apply centrally imposed Windows Group Policy settings using the Manageable Configuration Provider.

he first article in this series showed how to create custom configuration sections in your ASP.NET application configuration file, while the second article demonstrated using Windows Group Policy at both the machine and domain level to control configuration settings from a central location, to impose those settings on some or all the servers that run your Web applications. This article shows how you can apply those techniques using the Manageable Configuration Provider that is part of Microsoft's Enterprise Library.

Manageable Configuration in Enterprise Library
Enterprise Library 3.0, from Microsoft's patterns & practices group, includes a Manageable Configuration Source provider that implements a process very similar to the manual process you saw earlier in this article series.

The provider loads the application configuration data from a local Web.config or App.config file. For each value exposed in the configuration, the provider checks in the registry for the corresponding key to see whether Group Policy settings define a value for that setting. If there is a Group Policy value, the provider returns that value rather than the value in the configuration file.

The documentation for Enterprise Library contains step-by-step guides to setting up and using the Manageable Configuration Source provider. This article briefly explains that process within the context of a sample application, and lets you experiment to discover how the final configuration affects the behavior of the application.

The Manageable Configuration Sample Application
The sample application uses four Enterprise Library Application Blocks:

  • The Data Access Application Block with two databases configured, one using the SqlClient provider and one using the OleDb provider
  • The Logging Application Block to record data access exceptions in Windows Event Log
  • The Caching Application Block with the standard Isolated Storage provider and a custom file-based caching provider
  • The Cryptography Application Block with a Hash provider and a symmetric encryption provider
Author's Note: In this release of Enterprise Library, the Manageable Configuration Source does not support the Policy Injection Application Block or the Validation Application Block. There are also some limitations on the settings you can administer through Group Policy, and specific techniques for setting values for some of the application blocks. For more details, see the topic "Integrating Group Policy with Enterprise Library Applications" within the section "Using Group Policy and WMI with Enterprise Library" of the Enterprise Library documentation.

Figure 1. The Sample Application: The sample application demonstrates how to use the Manageable Configuration Provider in Enterprise Library
Figure 1 shows the sample application. It is, in fact, based on an application used in a previous series of articles "Using Enterprise Library in ASP.NET". You can read these to see exactly how the example uses Enterprise Library application blocks and a custom caching provider.

The application uses two databases defined within the Data Access Application Block configuration to fill two list boxes with the names of products from Microsoft's "Northwind" sample database. By default, these blocks use the SqlClient and the OleDbClient providers, as indicated by the connection strings displayed in the text boxes below each list.

The page also contains a "Cache a Dataset to Disk" button that creates a DataSet using the default database defined for the Data Access Application Block, and then caches it using the default caching provider defined for the Caching Application Block (the Isolated Storage Cache provider). The "Load Dataset from Disk Cache" button retrieves the DataSet from the default cache and displays the rows in the GridView control on the page.

Finally, there are three buttons that use features of the Cryptography Application Block to create a hash of the text in the Textbox control above the buttons, encrypt the text, and decrypt it again.

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