When Should I Use the Application Setting Manager?

You should consider using the Application Setting Manager whenever you need to store and retrieve configuration settings for your SharePoint applications. You can use the Application Setting Manager in server-side code to retrieve application configuration settings from any level in the SharePoint hierarchy.

Benefits of the Application Setting Manager

The Application Setting Manager provides the following benefits:

  • It provides a mechanism for managing application configuration settings that is consistent across all levels of the SharePoint hierarchy.
  • It provides a type-safe way to read and write application configuration settings.
  • It automatically manages the serialization and deserialization of configuration data.
  • It prevents developers from attempting to store nonserializable objects, which can corrupt SharePoint databases.
  • It enables you to structure application settings in a hierarchical way, such that a configuration key at a more specific level (such as the individual site) can override the same configuration key at a broader level (such as the Web application).
  • It provides a mechanism for reading and writing application settings that is integrated into SharePoint (as opposed to using some other configuration storage and retrieval mechanism such as a custom database or a configuration file).

Limitations and Considerations for the Application Setting Manager

You should consider the following limitations before you use the Application Setting Manager:

  • Because it uses property bags as its underlying storage mechanism, the Application Setting Manager is not suitable for storing large payloads. If you need to store data exceeding 4kilobytes (KB) in size, you should choose an alternative approach to storage. For example, you can configure the Application Setting Manager to use list-based property bags.
  • There are also certain configuration settings that must be stored in the Web.config file. These include configuration information for HTTP modules, HTTP handlers, and Windows Communication Foundation (WCF) endpoints. However, settings should be stored in the Web.config file only when SharePoint, Internet Information Services (IIS), or ASP.NET needs access to these settings to be able to operate. Settings that are specific to your solution should not be stored in the Web.config file.
  • Like with all approaches to managing application configuration settings, the security settings of the sandbox environment restrict what you can do with the Application Setting Manager. In a sandboxed solution, you can store and retrieve configuration settings at only the site level and the site collection level. However, the Application Setting Manager includes a full-trust proxy that enables you to read configuration settings from the Web application level and the farm level. The Application Setting Manager automatically detects whether this proxy is installed and uses it as appropriate.
  • The Application Setting Manager relies on XML serialization to store complex types as application settings. By default, the XML serialization process generates and compiles temporary assemblies. These operations are not permitted in the sandbox environment. You will need to take additional steps to be able to store complex types in application settings for sandboxed solutions.
  • The Application Setting Manager is designed to allow you to programmatically manage your configuration data. It does not include a user interface for administering configuration settings.