This documentation is archived and is not being maintained.

AddInSecurityLevel Enumeration

Specifies the trust level that is granted to the application domain that an add-in is loaded into.

Namespace:  System.AddIn.Hosting
Assembly:  System.AddIn (in System.AddIn.dll)

public enum AddInSecurityLevel

Member nameDescription
InternetUse the Internet security level for add-ins that have a low trust level.
IntranetUse the Intranet security level for add-ins that are located on a company's intranet. These add-ins can have a greater trust level because the servers and information are within a company's firewall.
FullTrustUse the full trust security level for add-ins that are allowed to read and write to the local file system, create network connections, and read from the registry. This security level grants full access to the add-in's code access security (CAS) by applying the Unrestricted field.
HostUse the host security level to give the add-in the same permissions currently granted to the hosting code.

This setting has two purposes:

  • It represents the maximum permission set a host can grant to its add-ins.

  • It allows a ClickOnce or an Extensible Application Markup Language (XAML) Browser Application (XBAP) host to propagate its site of origin to its add-ins, which enables them to contact the server.

The add-in system activates the add-in with the permission set that corresponds to the trust level specified for the add-in's application domain. That permission set is defined by the common language runtime's code access security (CAS) configuration.

The values of this enumeration cannot be combined by using the bitwise OR operation.

The following example activates an add-in with a specified trust level.

//Ask the user which add-in they would like to use.
AddInToken selectedToken = ChooseAddIn(tokens);

//Activate the selected AddInToken in a new
//application domain with the Internet trust level.
Calculator CalcAddIn = selectedToken.Activate<Calculator>(AddInSecurityLevel.Internet);

//Run the add-in using a custom method.

.NET Framework

Supported in: 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.