System.Net.WebPermission.AddPermission Method

Adds the specified URI string with the specified access rights to the current System.Net.WebPermission.

Syntax

public void AddPermission (NetworkAccess access, string uriString)

Parameters

access
A System.Net.NetworkAccess that specifies the access rights that are granted to the URI.
uriString
A string that describes the URI to which access rights are granted.

Remarks

If you have specified System.Security.Permissions.PermissionState.None as the System.Security.Permissions.PermissionState, use WebPermission.AddPermission(NetworkAccess, string) to permit the use of uriString in the target class. The way that uriString can be used by the target class is specified by access. Specify NetworkAccess.Accept as the access parameter to add the URI specified by the uriString parameter to the list of URI accept strings, or specify NetworkAccess.Connect as the access parameter to add the URI to the list of URI connect strings.

Note:

Calling WebPermission.AddPermission(NetworkAccess, string) on System.Security.Permissions.PermissionState.Unrestricted System.Net.WebPermission will have no effect, because permission is granted to all URIs.

Note:

A candidate URI string is checked against the list of relevant regular expressions (WebPermission.AcceptList or WebPermission.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.

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0