Adding the Policy Injection Application Block to the Configuration

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.

You can add the Policy Injection Application Block to the configuration of an application using either the stand-alone Configuration Console or the Visual Studio Configuration Editor. The next procedure explains how to add the Policy Injection Application Block to the configuration file using the stand-alone Configuration Console installed with Enterprise Library.

To add the Policy Injection Application Block to configuration using the stand-alone Configuration Console

  1. Start the Enterprise Library Configuration Console. To do this, click Start, point to All Programs, point to Microsoft patterns & practices, point to Enterprise Library 3.1 – May 2007, and then click Enterprise Library Configuration.
  2. Click New Application or Open Existing Application.
  3. Right-click Application Configuration, point to New, and then click Policy Injection Application Block.
  4. If you are editing the configuration for a Web Forms application that you intend to run in partial trust mode, click in the RequirePermission field (in the right-side list of properties for the selected node), and then click False in the drop-down list of valid property values.
  5. If you want to encrypt the configuration file, click in the ProtectionProvider field, and then click a protection provider in the drop-down list.

The next procedure explains how to add the Policy Injection Application Block to the configuration file using the Configuration Editor that Enterprise Library installs into Visual Studio2005.

To add the Policy Injection Application Block to configuration using the Visual Studio Configuration Editor

  1. Open Visual Studio 2005 and create a new project, or open an existing application to which you want to add the Policy Injection Application Block.
  2. If the project does not already contain a configuration file (for example, Web.config in a Web Forms project or App.config in a Windows Forms project), right-click the project name in Solution Explorer, click Add, and then click NewItem (in a Web Forms project, right-click, and then click Add New Item). Depending on the project type, select either Application Configuration File or Web Configuration File in the Add New Item dialog box, and then click OK.
  3. If the configuration file is open in the main Visual Studio editor window, close it.
  4. Right-click the configuration file (Web.config or App.config) in Solution Explorer, and then click Edit Enterprise Library Configuration to open the configuration file in the Visual Studio Configuration Editor.
  5. Right-click the node that contains the name of the configuration file (the node below the EnterpriseLibraryConfiguration root node) in the main editor window, point to New, and then click Policy Injection Application Block.
  6. The properties for the node selected in the main window appear in the Visual Studio Properties window. If you cannot see the Properties window, select PropertiesWindow on the View menu or press F4.
  7. If you are editing the configuration for a Web Forms application that you intend to run in partial trust mode, click in the RequirePermission property in the Properties window, and then click False in the drop-down list of valid property values.
  8. If you want to encrypt the configuration file, click in the ProtectionProvider property in the Properties window, and then click a protection provider in the drop-down list.

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.
Show: