Export (0) Print
Expand All

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.

For a list of all members of this type, see AllowPartiallyTrustedCallersAttribute Members.

System.Object
   System.Attribute
      System.Security.AllowPartiallyTrustedCallersAttribute

[Visual Basic]
<AttributeUsage(AttributeTargets.Assembly)>
NotInheritable Public Class AllowPartiallyTrustedCallersAttribute
   Inherits Attribute
[C#]
[AttributeUsage(AttributeTargets.Assembly)]
public sealed class AllowPartiallyTrustedCallersAttribute :
   Attribute
[C++]
[AttributeUsage(AttributeTargets::Assembly)]
public __gc __sealed class AllowPartiallyTrustedCallersAttribute :
   public Attribute
[JScript]
public
   AttributeUsage(AttributeTargets.Assembly)
class AllowPartiallyTrustedCallersAttribute extends
   Attribute

Thread Safety

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

Remarks

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   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.

Requirements

Namespace: System.Security

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Mscorlib (in Mscorlib.dll)

See Also

AllowPartiallyTrustedCallersAttribute Members | System.Security Namespace

Show:
© 2014 Microsoft