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.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)