Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

AllowPartiallyTrustedCallersAttribute Class

Allows strong-named assemblies to be called by partially trusted code. Without this declaration, only fully trusted callers are able to use such assemblies. This class cannot be inherited.

Namespace: System.Security
Assembly: mscorlib (in mscorlib.dll)

[ComVisibleAttribute(true)] 
[AttributeUsageAttribute(AttributeTargets::Assembly, AllowMultiple=false, Inherited=false)] 
public ref class AllowPartiallyTrustedCallersAttribute sealed : public Attribute
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple=false, Inherited=false) */ 
public final class AllowPartiallyTrustedCallersAttribute extends Attribute
ComVisibleAttribute(true) 
AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple=false, Inherited=false) 
public final class AllowPartiallyTrustedCallersAttribute extends Attribute
Not applicable.

AllowPartiallyTrustedCallersAttribute is only effective when applied by a strong-named assembly at the assembly level. For more information about applying attributes at the assembly level, see Applying Attributes.

By default, a strong-named assembly that does not explicitly apply this attribute at assembly level to allow its use by partially trusted code can be called only by other assemblies that are granted full trust by security policy. This restriction is enforced by placing a LinkDemand for FullTrust on every public or protected method on every publicly accessible class in the assembly. Assemblies that are intended to be called by partially trusted code can declare their intent through the use of the AllowPartiallyTrustedCallersAttribute. The attribute is declared at the assembly level. An example of the declaration in C# is [assembly:AllowPartiallyTrustedCallers] and in Visual Basic is <assembly:AllowPartiallyTrustedCallers>.

Caution noteCaution:

The presence of this assembly-level attribute prevents the default behavior of placing FullTrust  LinkDemand security checks, making the assembly callable from any other assembly (partially or fully trusted).

When this attribute is present, all other security checks function as intended, including any class-level or method-level declarative security attributes that are present. This attribute blocks only the implicit fully trusted caller demand.

This is not a declarative security attribute, but a regular attribute (it derives from Attribute, not SecurityAttribute).

For more information, see Using Libraries from Partially Trusted Code.

The following example shows the use of the AllowPartiallyTrustedCallersAttribute class.

No code example is currently available or this language may not be supported.

System.Object
   System.Attribute
    System.Security.AllowPartiallyTrustedCallersAttribute

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft