Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds the specified URI with the specified access rights to the current WebPermission.
AddPermission(NetworkAccess, String) |
Adds the specified URI string with the specified access rights to the current WebPermission. |
AddPermission(NetworkAccess, Regex) |
Adds the specified URI with the specified access rights to the current WebPermission. |
Adds the specified URI string with the specified access rights to the current WebPermission.
public:
void AddPermission(System::Net::NetworkAccess access, System::String ^ uriString);
public void AddPermission(System.Net.NetworkAccess access, string uriString);
member this.AddPermission : System.Net.NetworkAccess * string -> unit
Public Sub AddPermission (access As NetworkAccess, uriString As String)
A NetworkAccess that specifies the access rights that are granted to the URI.
A string that describes the URI to which access rights are granted.
uriString
is null
.
If you have specified None as the PermissionState, use AddPermission 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 Accept as the access parameter to add the URI specified by the uriString
parameter to the list of URI accept strings, or specify Connect as the access parameter to add the URI to the list of URI connect strings.
Note
Calling AddPermission on UnrestrictedWebPermission 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 (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.
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 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
Adds the specified URI with the specified access rights to the current WebPermission.
public:
void AddPermission(System::Net::NetworkAccess access, System::Text::RegularExpressions::Regex ^ uriRegex);
public void AddPermission(System.Net.NetworkAccess access, System.Text.RegularExpressions.Regex uriRegex);
member this.AddPermission : System.Net.NetworkAccess * System.Text.RegularExpressions.Regex -> unit
Public Sub AddPermission (access As NetworkAccess, uriRegex As Regex)
A NetworkAccess that specifies the access rights that are granted to the URI.
A regular expression that describes the set of URIs to which access rights are granted.
The uriRegex
parameter is null
.
If you have specified None as the PermissionState, use AddPermission to allow the use of uriRegex
in the target class. Specify Accept as the access
parameter to add the URI specified by the uriRegex
parameter to the list of URI accept strings, or specify Connect as the access parameter to add the URI to the list of URI connect strings.
Note
Calling AddPermission on an UnrestrictedWebPermission instance will have no effect as permission is granted to all URIs.
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.
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 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in