Bewerken

Share via


UrlIdentityPermission Constructors

Definition

Initializes a new instance of the UrlIdentityPermission class.

Overloads

UrlIdentityPermission(PermissionState)

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

UrlIdentityPermission(String)

Initializes a new instance of the UrlIdentityPermission class to represent the URL identity described by site.

UrlIdentityPermission(PermissionState)

Source:
UrlIdentityPermission.cs
Source:
UrlIdentityPermission.cs

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

public:
 UrlIdentityPermission(System::Security::Permissions::PermissionState state);
public UrlIdentityPermission (System.Security.Permissions.PermissionState state);
new System.Security.Permissions.UrlIdentityPermission : System.Security.Permissions.PermissionState -> System.Security.Permissions.UrlIdentityPermission
Public Sub New (state As PermissionState)

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 UrlIdentityPermission.UrlIdentityPermission(PermissionState) constructor.

UrlIdentityPermission ^ permIdPerm2 = gcnew UrlIdentityPermission(PermissionState::None);
UrlIdentityPermission permIdPerm2 = new UrlIdentityPermission(PermissionState.None);
Dim permIdPerm2 As New UrlIdentityPermission(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

UrlIdentityPermission(String)

Source:
UrlIdentityPermission.cs
Source:
UrlIdentityPermission.cs

Initializes a new instance of the UrlIdentityPermission class to represent the URL identity described by site.

public:
 UrlIdentityPermission(System::String ^ site);
public UrlIdentityPermission (string site);
new System.Security.Permissions.UrlIdentityPermission : string -> System.Security.Permissions.UrlIdentityPermission
Public Sub New (site As String)

Parameters

site
String

A URL or wildcard expression.

Exceptions

The site parameter is null.

The length of the site parameter is zero.

The URL, directory, or site portion of the site parameter is not valid.

Examples

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

UrlIdentityPermission ^ permIdPerm1 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/process/");
UrlIdentityPermission permIdPerm1 = new UrlIdentityPermission("http://www.fourthcoffee.com/process/");
Dim permIdPerm1 As New UrlIdentityPermission("http://www.fourthcoffee.com/process/")

Remarks

The complete URL is considered, including the protocol (HTTP, HTTPS, FTP) and the file, for example: http://www.fourthcoffee.com/process/grind.htm/.

URLs can be matched exactly or by a wildcard in the final position, for example: http://www.fourthcoffee.com/process/*. URLs can also contain a wildcard ("*") prefix at the dot delimiter. For example, the URL name string http://www.fourthcoffee.com/process/grind.htm/ is a subset of http://*.fourthcoffee.com/process/grind.htm/ and http://*.com/process/grind.htm/.

Note

Starting with the .NET Framework version 2.0, for performance reasons, an invalid URL does not cause an argument exception at the time the new class instance is created. The argument exception will occur when one of the set operations (Union, Intersect, or IsSubsetOf) is executed. A demand on the permission causes IsSubsetOf to be called by the security infrastructure. The demand will fail because of the argument exception, resulting in a SecurityException being thrown. In this case, the original ArgumentException exception will not be seen.

Applies to