PolicyStatement.PermissionSet Property

Definition

Caution

Code Access Security is not supported or honored by the runtime.

Gets or sets the PermissionSet of the policy statement.

public:
 property System::Security::PermissionSet ^ PermissionSet { System::Security::PermissionSet ^ get(); void set(System::Security::PermissionSet ^ value); };
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public System.Security.PermissionSet PermissionSet { get; set; }
public System.Security.PermissionSet PermissionSet { get; set; }
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.PermissionSet : System.Security.PermissionSet with get, set
member this.PermissionSet : System.Security.PermissionSet with get, set
Public Property PermissionSet As PermissionSet

Property Value

The PermissionSet of the policy statement.

Attributes

Examples

The following code example shows how to use the PermissionSet property to add permissions to the policy statement. This code example is part of a larger example provided for the PolicyStatement class.

NamedPermissionSet^ allPerms = gcnew NamedPermissionSet(
   L"allPerms" );
allPerms->AddPermission( gcnew SecurityPermission(
   SecurityPermissionFlag::Execution ) );
allPerms->AddPermission( gcnew ZoneIdentityPermission(
   SecurityZone::MyComputer ) );
allPerms->AddPermission( gcnew SiteIdentityPermission(
   L"www.contoso.com" ) );

( *policyStatement)->PermissionSet = allPerms;
NamedPermissionSet allPerms = new NamedPermissionSet("allPerms");
allPerms.AddPermission(
    new SecurityPermission(SecurityPermissionFlag.Execution));
allPerms.AddPermission(
    new ZoneIdentityPermission(SecurityZone.MyComputer));
allPerms.AddPermission(
    new SiteIdentityPermission("www.contoso.com"));

policyStatement.PermissionSet = allPerms;
Dim allPerms As New NamedPermissionSet("allPerms")
allPerms.AddPermission( _
    New SecurityPermission(SecurityPermissionFlag.Execution))
allPerms.AddPermission( _
    New ZoneIdentityPermission(SecurityZone.MyComputer))
allPerms.AddPermission( _
    New SiteIdentityPermission("www.contoso.com"))

policyStatement.PermissionSet = allPerms

Remarks

Caution

Code Access Security (CAS) has been deprecated across all versions of .NET Framework and .NET. Recent versions of .NET do not honor CAS annotations and produce errors if CAS-related APIs are used. Developers should seek alternative means of accomplishing security tasks.

Applies to