public class WebPermission : CodeAccessPermission
Object
CodeAccessPermission
WebPermissionThis type implements IPermission.
System
Networking
Controls access to Internet resources.
The XML encoding of a WebPermission instance is defined below in EBNF format. The following conventions are used:
The following meta-language symbols are used:
- All non-literals in the grammar below are shown in normal type.
- All literals are in bold font.
BuildVersion refers to the build version of the shipping CLI. This is a dotted build number such as '2412.0'.
- '*' represents a meta-language symbol suffixing an expression that can appear zero or more times.
- '?' represents a meta-language symbol suffixing an expression that can appear zero or one time.
- '+' represents a meta-language symbol suffixing an expression that can appear one or more times.
- '(',')' is used to group literals, non-literals or a mixture of literals and non-literals.
- '|' denotes an exclusive disjunction between two expressions.
- '::= ' denotes a production rule where a left hand non-literal is replaced by a right hand expression containing literals, non-literals or both.
ECMAPubKeyToken ::=
b77a5c561934e089
HostName refers to a host name such as
www.contoso.com
.Portnumber denotes a Int32 value indicating a port.
TransportProtocol ::=
1
|2
|3
/*1= UDP , 2 = TCP, 3 = both */
WebPermissionXML ::=
<IPermission
class="
System.Net.WebPermission,
System,
Version=1.0.
BuildVersion,
Culture=neutral,
PublicKeyToken=
ECMAPubKeyToken"
version="1"
(
Unrestricted="true"/>
)
|
>
(
<ConnectAccess>
(
<URI>
HostName#
PortNumber#
TransportProtocol</URI>
)+
</ConnectAccess>
</IPermission>
)
|
>
(
<AcceptAccess>
(
<URI>
HostName#
PortNumber#
TransportProtocol</URI>
)+
</AcceptAccess>
</IPermission>
)
|
/>
System.Net Namespace
WebPermission Constructors
WebPermission(System.Security.Permissions.PermissionState) Constructor
WebPermission(System.Net.NetworkAccess, System.String) Constructor
WebPermission Methods
WebPermission.Copy Method
WebPermission.FromXml Method
WebPermission.Intersect Method
WebPermission.IsSubsetOf Method
WebPermission.ToXml Method
WebPermission.Union Method
public WebPermission(PermissionState state);
Constructs and initializes a new instance of the WebPermission class with the specified PermissionState value.
- state
- A PermissionState value.
[Note: This constructor creates either fully restricted (System.Security.Permissions.PermissionState.None) or System.Security.Permissions.PermissionState.Unrestricted access to Internet resources.]
System.Net.WebPermission Class, System.Net Namespace
public WebPermission(NetworkAccess access, string uriString);
Constructs and initializes a new instance of the WebPermission class that secures access to the specified URI.
- access
- A NetworkAccess value indicating the type of access to secure.
- uriString
- A String that represents the URI to grant access rights to. [Note: For more information on the format of this string, see Uri.]
Exception Type Condition ArgumentNullException uriString is null
.
System.Net.WebPermission Class, System.Net Namespace
public override IPermission Copy();
Returns a new WebPermission object containing the same values as the current instance.
A new WebPermission instance containing the same values as the current instance.
[Note: The object returned by this method represents the same access to resources as the current instance.This method overrides System.Security.CodeAccessPermission.Copy and is implemented to support the IPermission interface.
]
System.Net.WebPermission Class, System.Net Namespace
public override void FromXml(SecurityElement securityElement);
Reconstructs the state of a WebPermission object using the specified XML encoding.
- securityElement
- A SecurityElement instance containing the XML encoding to use to reconstruct the state of a WebPermission object.
Exception Type Condition ArgumentNullException securityElement is null
.
ArgumentException securityElement does not contain the encoding for a WebPermission instance.
The state of the current instance is changed to the state encoded in securityElement.[Note: For the XML encoding for this class, see the WebPermission class page.
This method overrides System.Security.CodeAccessPermission.FromXml(System.Security.SecurityElement) .
]
System.Net.WebPermission Class, System.Net Namespace
public override IPermission Intersect(IPermission target);
Returns a new WebPermission object that is the intersection of the current instance and the specified object.
- target
- A WebPermission instance to intersect with the current instance.
A new WebPermission instance that represents the intersection of the current instance and target. If the intersection is empty, returnsnull
. If the current instance is unrestricted, returns a copy of target. If target is unrestricted, returns a copy of the current instance.
Exception Type Condition ArgumentNullException target is null
.ArgumentException target is not null
and is not of type WebPermission .
[Note: The intersection of two permissions is a permission that secures the resources and operations secured by both permissions. Specifically, it represents the minimum permission such that any demand that passes both permissions will also pass their intersection.This method overrides System.Security.CodeAccessPermission.Intersect(System.Security.IPermission) and is implemented to support the IPermission interface.
]
System.Net.WebPermission Class, System.Net Namespace
public override bool IsSubsetOf(IPermission target);
Determines whether the current instance is a subset of the specified object.
- target
- A WebPermission instance that is to be tested for the subset relationship.
true
if the current instance is a subset of target ; otherwise,false
. If target is null, returnfalse
. If the current instance is unrestricted, and target is not, returnsfalse
. If target is unrestricted, returnstrue
.
Exception Type Condition ArgumentException target is not of type WebPermission.
[Note: The current instance is a subset of target if the current instance specifies a set of accesses to resources that is wholly contained by target. For example, a permission that represents read access to a file is a subset of a permission that represents read and write access to the file.If this method returns
true
, the current instance describes access to internet resources that is also described by target .This method overrides System.Security.CodeAccessPermission.IsSubsetOf(System.Security.IPermission) and is implemented to support the IPermission interface.
]
System.Net.WebPermission Class, System.Net Namespace
public override SecurityElement ToXml();
Returns the XML encoding of the current instance.
A SecurityElement containing the XML encoding of the state of the current instance.
[Note: For the XML encoding for this class, see the WebPermission class page.This method overrides System.Security.CodeAccessPermission.ToXml .
]
System.Net.WebPermission Class, System.Net Namespace
public override IPermission Union(IPermission target);
Returns a new WebPermission object that is the union of the current instance and the specified object.
- target
- The WebPermission instance to combine with the current instance.
A new WebPermission instance that represents the union of the current instance and target. If the current instance or target is unrestricted, returns a WebPermission instance that is unrestricted.
Exception Type Condition ArgumentNullException target is null
.ArgumentException target is not null
and is not of type WebPermission .
[Note: The result of a call to System.Net.WebPermission.Union(System.Security.IPermission) is a permission that represents all of the access to permissions represented by the current instance as well as the permissions represented by target. Any demand that passes either the current instance or target passes their union.This method overrides System.Security.CodeAccessPermission.Union(System.Security.IPermission) and is implemented to support the IPermission interface.
]
System.Net.WebPermission Class, System.Net Namespace