Edit

Share via


ZoneIdentityPermission Constructors

Definition

Initializes a new instance of the ZoneIdentityPermission class.

Overloads

ZoneIdentityPermission(PermissionState)

Initializes a new instance of the ZoneIdentityPermission class with the specified PermissionState.

ZoneIdentityPermission(SecurityZone)

Initializes a new instance of the ZoneIdentityPermission class to represent the specified zone identity.

ZoneIdentityPermission(PermissionState)

Source:
ZoneIdentityPermission.cs
Source:
ZoneIdentityPermission.cs
Source:
ZoneIdentityPermission.cs
Source:
ZoneIdentityPermission.cs
Source:
ZoneIdentityPermission.cs

Initializes a new instance of the ZoneIdentityPermission class with the specified PermissionState.

public ZoneIdentityPermission(System.Security.Permissions.PermissionState state);

Parameters

state
PermissionState

One of the PermissionState values.

Exceptions

The state parameter is not a valid value of PermissionState.

Examples

The following example shows the use of the ZoneIdentityPermission.ZoneIdentityPermission(PermissionState) constructor.

ZoneIdentityPermission zoneIdPerm2 = new ZoneIdentityPermission(PermissionState.None);

Remarks

Creates either a fully restricted (None) or Unrestricted permission.

Note

In the .NET Framework versions 1.0 and 1.1, identity permissions cannot have an Unrestricted permission state value. Starting with the .NET Framework version 2.0, identity permissions can have any permission state value. This means that in 2.0 and later versions, identity permissions have the same behavior as permissions that implement the IUnrestrictedPermission interface. That is, a demand for an identity always succeeds, regardless of the identity of the assembly, if the assembly has been granted full trust.

In the .NET Framework versions 1.0 and 1.1, demands on the identity permissions are effective, even when the calling assembly is fully trusted. That is, although the calling assembly has full trust, a demand for an identity permission fails if the assembly does not meet the demanded criteria. Starting with the .NET Framework version 2.0, demands for identity permissions are ineffective if the calling assembly has full trust. This assures consistency for all permissions, eliminating the treatment of identity permissions as a special case.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ZoneIdentityPermission(SecurityZone)

Source:
ZoneIdentityPermission.cs
Source:
ZoneIdentityPermission.cs
Source:
ZoneIdentityPermission.cs
Source:
ZoneIdentityPermission.cs
Source:
ZoneIdentityPermission.cs

Initializes a new instance of the ZoneIdentityPermission class to represent the specified zone identity.

public ZoneIdentityPermission(System.Security.SecurityZone zone);

Parameters

zone
SecurityZone

The zone identifier.

Examples

The following example shows the use of the ZoneIdentityPermission.ZoneIdentityPermission(SecurityZone) constructor.

ZoneIdentityPermission zoneIdPerm1 = new ZoneIdentityPermission(SecurityZone.Intranet);

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10