[Serializable] |
NetCodeGroup has the same merge semantics as that of UnionCodeGroup; it forms the union of the PolicyStatement objects of all matching child code groups and the PolicyStatement it generates from the input Url evidence. However, NetCodeGroup returns a permission set that contains a dynamically-calculated WebPermission that grants connect access to the site from which the code is run; UnionCodeGroup only returns a static permission set.
Access is only granted for the protocol over which the code was run, with the exception that code run over the HTTP protocol is granted access for both the HTTP and HTTPS protocols. For example, code from http://www.fourthcoffee.com/1/2/app.exe is granted permission to connect to http://www.fourthcoffee.com/* and https://www.fourthcoffee.com/*, but code from https://www.fourthcoffee.com/1/2/app.exe only gets permission to connect to https://www.fourthcoffee.com/*. This is done to ensure that an assembly cannot communicate over a less secure protocol than the one from which it was run. If an assembly could communicate over a less secure protocol, it would violate the user's expectation regarding the security of any information transmitted by that assembly.
ctor #1 | Initializes a new instance of the NetCodeGroup class. |
AttributeString | Read-only Overridden: Gets a string representation of the attributes of the policy statement for the code group. |
Children (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.Children Gets or sets an ordered list of the child code groups of a code group. |
Description (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.Description Gets or sets the description of the code group. |
MembershipCondition (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.MembershipCondition Gets or sets the code group's membership condition. |
MergeLogic | Read-only Overridden: Gets the logic to use for merging groups. |
Name (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.Name Gets or sets the name of the code group. |
PermissionSetName | Read-only Overridden: Gets the name of the NamedPermissionSet for the code group. |
PolicyStatement (inherited from System.Security.Policy.CodeGroup) |
Read-write See base class member description: System.Security.Policy.CodeGroup.PolicyStatement Gets or sets the policy statement associated with the code group. |
AddChild (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.AddChild Adds a child code group to the current code group. |
Copy | Overridden: Makes a deep copy of the current code group. |
Equals (inherited from System.Security.Policy.CodeGroup) |
Overloaded:Equals(object o) See base class member description: System.Security.Policy.CodeGroup.EqualsDetermines whether the specified code group is equivalent to the current code group. |
Equals (inherited from System.Security.Policy.CodeGroup) |
Overloaded:Equals(CodeGroup cg, bool compareChildren) See base class member description: System.Security.Policy.CodeGroup.EqualsDetermines whether the specified code group is equivalent to the current code group, checking the child code groups as well, if specified. |
FromXml (inherited from System.Security.Policy.CodeGroup) |
Overloaded:FromXml(SecurityElement e) See base class member description: System.Security.Policy.CodeGroup.FromXmlReconstructs a security object with a given state from an XML encoding. |
FromXml (inherited from System.Security.Policy.CodeGroup) |
Overloaded:FromXml(SecurityElement e, PolicyLevel level) See base class member description: System.Security.Policy.CodeGroup.FromXmlReconstructs a security object with a given state and policy level from an XML encoding. |
GetHashCode (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.GetHashCode Gets the hash code of the current code group. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
RemoveChild (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.RemoveChild Removes the specified child code group. |
Resolve | Overridden: Resolves policy for the code group and its descendants for a set of evidence. |
ResolveMatchingCodeGroups | Overridden: Resolves matching code groups. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
ToXml (inherited from System.Security.Policy.CodeGroup) |
Overloaded:ToXml() See base class member description: System.Security.Policy.CodeGroup.ToXmlCreates an XML encoding of the security object and its current state. |
ToXml (inherited from System.Security.Policy.CodeGroup) |
Overloaded:ToXml(PolicyLevel level) See base class member description: System.Security.Policy.CodeGroup.ToXmlCreates an XML encoding of the security object, its current state, and the policy level within which the code exists. |
CreateXml (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.CreateXml When overridden in a derived class, serializes properties and internal state specific to a derived code group and adds the serialization to the specified SecurityElement. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
ParseXml (inherited from System.Security.Policy.CodeGroup) |
See base class member description: System.Security.Policy.CodeGroup.ParseXml When overridden in a derived class, reconstructs properties and internal state specific to a derived code group from the specified SecurityElement. |
Hierarchy:
public NetCodeGroup( |
membershipCondition
Exception Type | Condition |
---|---|
ArgumentNullException | The membershipCondition parameter is null. |
ArgumentException | The type of the membershipCondition parameter is not valid. |
public override string AttributeString {get;}
|
public IList Children {get; set;}
|
Exception Type | Condition |
---|---|
ArgumentException | An attempt is made to set this property to null. |
public string Description {get; set;}
|
public IMembershipCondition MembershipCondition {get; set;}
|
Exception Type | Condition |
---|---|
ArgumentException | An attempt is made to set this parameter to null. |
public override string MergeLogic {get;}
|
public string Name {get; set;}
|
public override string PermissionSetName {get;}
|
public PolicyStatement PolicyStatement {get; set;}
|
This property can also be set by passing a policy statement to the constructor.
codeGroup.PolicyStatement = new PolicyStatement(new NamedPermissionSet("MyPermissionSet"));
public void AddChild( |
group
Exception Type | Condition |
---|---|
ArgumentNullException | The group parameter is null. |
ArgumentException | The group parameter is not a valid code group. |
public override CodeGroup Copy(); |
protected virtual void CreateXml( |
element
level
The XML created using this method is deserialized by the CodeGroup.ParseXml method.
o
This method tests the top-level code group only, not its child code groups.
cg
compareChildren
If the compareChildren parameter is true, this method will only return true if the current code group and all its child code groups are equivalent to the specified code group and all its child code groups.
~NetCodeGroup(); |
public void FromXml( |
e
Exception Type | Condition |
---|---|
ArgumentNullException | The e parameter is null. |
public void FromXml( |
e
level
Exception Type | Condition |
---|---|
ArgumentNullException | The e parameter is null. |
public override int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
protected virtual void ParseXml( |
e
level
This method deserializes XML created using CodeGroup.CreateXml.
public void RemoveChild( |
group
Exception Type | Condition |
---|---|
ArgumentException | The group parameter is not an immediate child code group of the current code group. |
public override PolicyStatement Resolve( |
evidence
Exception Type | Condition |
---|---|
ArgumentNullException | The evidence parameter is null. |
PolicyException | More than one code group (including the parent code group and any child code groups) is marked PolicyStatementAttribute.Exclusive. |
The operation of this method is as follows:
If the membership condition does not match the specified evidence, return null; otherwise, set the permission set to be returned (P) equal to the code group's policy statement and continue. For each child code group, resolve the code group with the same evidence; if the result is not null, return that policy statement. If no child code group matched, return P (the parent's policy statement).
evidence
Exception Type | Condition |
---|---|
ArgumentNullException | The evidence parameter is null. |
public virtual string ToString(); |
public SecurityElement ToXml(); |
public SecurityElement ToXml( |
level