Edit

Share via


WebPermission Constructors

Definition

Creates a new instance of the WebPermission class.

Overloads

WebPermission()

Creates a new instance of the WebPermission class.

WebPermission(PermissionState)

Creates a new instance of the WebPermission class that passes all demands or fails all demands.

WebPermission(NetworkAccess, String)

Initializes a new instance of the WebPermission class with the specified access rights for the specified URI.

WebPermission(NetworkAccess, Regex)

Initializes a new instance of the WebPermission class with the specified access rights for the specified URI regular expression.

WebPermission()

Source:
WebPermission.cs
Source:
WebPermission.cs
Source:
WebPermission.cs
Source:
WebPermission.cs
Source:
WebPermission.cs

Creates a new instance of the WebPermission class.

public:
 WebPermission();
public WebPermission();
Public Sub New ()

Remarks

Creates a new instance of the WebPermission class. This constructor creates an empty permission that does not grant any rights.

See also

Applies to

WebPermission(PermissionState)

Source:
WebPermission.cs
Source:
WebPermission.cs
Source:
WebPermission.cs
Source:
WebPermission.cs
Source:
WebPermission.cs

Creates a new instance of the WebPermission class that passes all demands or fails all demands.

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

Parameters

Remarks

The value of the state parameter is either PermissionState.None or PermissionState.Unrestricted, respectively yielding fully restricted or fully unrestricted access to all security variables. If you specify PermissionState.None, then you can give access to individual URIs using AddPermission.

See also

Applies to

WebPermission(NetworkAccess, String)

Source:
WebPermission.cs
Source:
WebPermission.cs
Source:
WebPermission.cs
Source:
WebPermission.cs
Source:
WebPermission.cs

Initializes a new instance of the WebPermission class with the specified access rights for the specified URI.

public:
 WebPermission(System::Net::NetworkAccess access, System::String ^ uriString);
public WebPermission(System.Net.NetworkAccess access, string uriString);
new System.Net.WebPermission : System.Net.NetworkAccess * string -> System.Net.WebPermission
Public Sub New (access As NetworkAccess, uriString As String)

Parameters

access
NetworkAccess

A NetworkAccess value that indicates what kind of access to grant to the specified URI. Accept indicates that the application is allowed to accept connections from the Internet on a local resource. Connect indicates that the application is allowed to connect to specific Internet resources.

uriString
String

A URI string to which access rights are granted.

Exceptions

uriString is null.

Remarks

This constructor initializes a WebPermission and grants its target permission to either make a remote host connection or accept a remote host connection using the URI described by the uriString parameter.

See also

Applies to

WebPermission(NetworkAccess, Regex)

Source:
WebPermission.cs
Source:
WebPermission.cs
Source:
WebPermission.cs
Source:
WebPermission.cs
Source:
WebPermission.cs

Initializes a new instance of the WebPermission class with the specified access rights for the specified URI regular expression.

public:
 WebPermission(System::Net::NetworkAccess access, System::Text::RegularExpressions::Regex ^ uriRegex);
public WebPermission(System.Net.NetworkAccess access, System.Text.RegularExpressions.Regex uriRegex);
new System.Net.WebPermission : System.Net.NetworkAccess * System.Text.RegularExpressions.Regex -> System.Net.WebPermission
Public Sub New (access As NetworkAccess, uriRegex As Regex)

Parameters

access
NetworkAccess

A NetworkAccess value that indicates what kind of access to grant to the specified URI. Accept indicates that the application is allowed to accept connections from the Internet on a local resource. Connect indicates that the application is allowed to connect to specific Internet resources.

uriRegex
Regex

A regular expression that describes the URI to which access is to be granted.

Remarks

This constructor initializes a WebPermission and grants its target permission to either make a remote host connection or accept a remote host connection using the URI described by the uriRegex parameter.

Note

It is recommended that you create uriRegex using the RegexOptions.IgnoreCase, RegexOptions.Compiled, and RegexOptions.Singleline flags.

Note

A candidate URI string is checked against the list of relevant regular expressions (AcceptList or ConnectList) in two ways. First, the candidate URI string is checked against the appropriate list; then, if there is no match, the candidate URI string is converted into a Uri and checked against the appropriate list.

See also

Applies to