UrlIdentityPermission Constructor (PermissionState)


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

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

public UrlIdentityPermission(
	PermissionState state


Type: System.Security.Permissions.PermissionState

One of the PermissionState values.

Exception Condition

The state parameter is not a valid value of PermissionState.

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


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.

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

UrlIdentityPermission permIdPerm2 = new UrlIdentityPermission(PermissionState.None);

.NET Framework
Available since 1.1
Return to top