Export (0) Print
Expand All

Adding Application Code

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.

The Security Application Block is designed to support the most common scenarios for authorization and caching of security information. When you add your application code, refer to the scenarios in the Key Scenarios section, and select the ones that best match your situation. Use the code that accompanies the scenario as-is or adapt it as necessary.

First, you must prepare your application to use the Security Application Block.

To prepare your application

  1. Add a reference to the Security Application Block assembly. In Visual Studio, right-click your project node in Solution Explorer, and then click Add References. Click the Browse tab, and then navigate to the location of the Microsoft.Practices.EnterpriseLibrary.Security.dll assembly. Select the assembly, and then click OK to add the reference.
  2. Follow the same procedure to set a reference to the Enterprise Library Common assembly, Microsoft.Practices.EnterpriseLibrary.Common.dll and to the ObjectBuilder assembly, Microsoft.Practices.EnterpriseLibrary.ObjectBuilder.dll.
  3. If you are going to use security caching, set a reference to the assembly Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore.dll. You also need to add a reference to the Data Access Application Block assembly, Microsoft.Practices.EnterpriseLibrary.Data.dll, if you are using the DatabaseCacheStorage option in the configuration console.
  4. (Optional) To use elements from Security Application Block without fully qualifying the element reference, you can add the using statement (C#) or Imports statement (Visual Basic) to the top of your source code file. The following code shows how to add these statements for the Microsoft.Practices.EnterpriseLibrary.Security namespace.
    using Microsoft.Practices.EnterpriseLibrary.Security;
    
    
    Ff647920.note(en-us,PandP.10).gifNote:
    For Visual Basic projects, you can use the References page of the Project Designer to manage references and imported namespaces. To access the References page, select a project node in Solution Explorer. On the Project menu, click Properties. In the Project Designer, click the References tab.

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:
© 2015 Microsoft