This documentation is archived and is not being maintained.

GacIdentityPermissionAttribute.GacIdentityPermissionAttribute Constructor

Initializes a new instance of the GacIdentityPermissionAttribute class with the specified SecurityAction value.

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

public GacIdentityPermissionAttribute (
	SecurityAction action
)
public GacIdentityPermissionAttribute (
	SecurityAction action
)
public function GacIdentityPermissionAttribute (
	action : SecurityAction
)
Not applicable.

Parameters

action

One of the SecurityAction values.

Exception typeCondition

ArgumentException

The action parameter is not a valid SecurityAction value.

The constructor calls the base class to validate the SecurityAction value.

This constructor associates a SecurityAction (for example, Demand) with the GacIdentityPermission.

The security information declared by a security attribute is stored in the metadata of the attribute target and is accessed by the system at run time. Security attributes are used only for declarative security. Use GacIdentityPermission for imperative security.

The following code example demonstrates the use of the GacIdentityPermissionAttribute constructor to demand that the calling program be in the global assembly cache. This example is part of a larger example provided for the GacIdentityPermissionAttribute class.

// Demand that the calling program be in the global assembly cache.
[GacIdentityPermissionAttribute(SecurityAction.Demand)]
public class Class1

// Demand that the calling program be in the global assembly cache.
/** @attribute GacIdentityPermissionAttribute(SecurityAction.Demand)
 */

public class Class1

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
Show: