System.Security.Policy.SiteMembershipCondition Class

Assembly: Mscorlib.dll
Namespace: System.Security.Policy
Summary
Determines whether an assembly belongs to a code group by testing the site from which it originated. This class cannot be inherited.
C# Syntax:
[Serializable]
public sealed class SiteMembershipCondition : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable
Remarks
A code assembly satisfies a site membership condition if that code originates from the Web site specified by SiteMembershipCondition.Site. Site identity is defined for code from URLs with any protocol except FILE. A site is the string between the "//" after the protocol of a URL and the following "/", if present. For example, www.fourthcoffee.com is the site identity in the URL http://www.fourthcoffee.com/process/grind.htm. This excludes port numbers. If a given URL is http://www.fourthcoffee.com:8000/, the site is www.fourthcoffee.com, not www.fourthcoffee.com:8000.

Sites can be matched exactly, or by a wildcard ("*") prefix at the dot delimiter. For example, the site name *.fourthcoffee.com matches fourthcoffee.com as well as www.fourthcoffee.com. Without a wildcard, the site name must be a precise match. The site name * will match any site, but will not match code that has no site evidence.

See also:
System.Security.Policy Namespace

System.Security.Policy.SiteMembershipCondition Member List:

Public Constructors
ctor #1 Initializes a new instance of the SiteMembershipCondition class with name of the site that determines membership.
Public Properties
Site Read-write

Gets or sets the site for which the membership condition tests.
Public Methods
Check Determines whether the specified evidence satisfies the membership condition.
Copy Creates an equivalent copy of the membership condition.
Equals Overridden:
Determines whether the site from the specified SiteMembershipCondition object is equivalent to the site contained in the current SiteMembershipCondition.
FromXml Overloaded:
FromXml(SecurityElement e)

Reconstructs a security object with a specified state from an XML encoding.
FromXml Overloaded:
FromXml(SecurityElement e, PolicyLevel level)

Reconstructs a security object with a specified state from an XML encoding.
GetHashCode Overridden:
Gets the hash code for the current membership condition.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToString Overridden:
Creates and returns a string representation of the membership condition.
ToXml Overloaded:
ToXml()

Creates an XML encoding of the security object and its current state.
ToXml Overloaded:
ToXml(PolicyLevel level)

Creates an XML encoding of the security object and its current state with the specified PolicyLevel.
Protected Methods
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.

Hierarchy:


System.Security.Policy.SiteMembershipCondition Member Details

ctor #1
Summary
Initializes a new instance of the SiteMembershipCondition class with name of the site that determines membership.
C# Syntax:
public SiteMembershipCondition(
   string site
);
Parameters:

site

The site name or wildcard expression.

Exceptions
Exception Type Condition
ArgumentNullException The site parameter is null.
ArgumentException The site parameter is not a valid Site.
Remarks
Code satisfies this membership condition if it is downloaded from a site whose DNS name matches the site specified by SiteMembershipCondition.Site.

Return to top


Property: Site (read-write)
Summary
Gets or sets the site for which the membership condition tests.
C# Syntax:
public string Site {get; set;}
Exceptions
Exception Type Condition
ArgumentNullException An attempt is made to set SiteMembershipCondition.Site to null.
ArgumentException An attempt is made to set SiteMembershipCondition.Site to an invalid Site.
Remarks
This property is matched against the site from which a code assembly originates to test the membership condition.

Return to top


Method: Check(
   Evidence evidence
)
Summary
Determines whether the specified evidence satisfies the membership condition.
C# Syntax:
public bool Check(
   Evidence evidence
);
Parameters:

evidence

The Evidence against which to make the test.

Return Value:
true if the specified evidence satisfies the membership condition; otherwise, false.
Implements:
IMembershipCondition.Check
Remarks
This membership condition tests only Site evidence.

Return to top


Method: Copy()
Summary
Creates an equivalent copy of the membership condition.
C# Syntax:
public IMembershipCondition Copy();
Return Value:
A new, identical copy of the current membership condition.
Implements:
IMembershipCondition.Copy

Return to top


Overridden Method: Equals(
   object o
)
Summary
Determines whether the site from the specified SiteMembershipCondition object is equivalent to the site contained in the current SiteMembershipCondition.
C# Syntax:
public override bool Equals(
   object o
);
Parameters:

o

The SiteMembershipCondition object to compare to the current SiteMembershipCondition.

Return Value:
true if the site from the specified SiteMembershipCondition object is equivalent to the site contained in the current SiteMembershipCondition; otherwise, false.
Implements:
IMembershipCondition.Equals

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~SiteMembershipCondition();

For more information on members inherited from System.Object click on the link above.

Return to top


Overloaded Method: FromXml(
   SecurityElement e
)
Summary
Reconstructs a security object with a specified state from an XML encoding.
C# Syntax:
public void FromXml(
   SecurityElement e
);
Parameters:

e

The XML encoding to use to reconstruct the security object.

Implements:
ISecurityEncodable.FromXml

Return to top


Overloaded Method: FromXml(
   SecurityElement e,
   PolicyLevel level
)
Summary
Reconstructs a security object with a specified state from an XML encoding.
C# Syntax:
public void FromXml(
   SecurityElement e,
   PolicyLevel level
);
Parameters:

e

The XML encoding to use to reconstruct the security object.

level

The PolicyLevel context, used to resolve NamedPermissionSet references.

Exceptions
Exception Type Condition
ArgumentNullException The e parameter is null.
ArgumentException The e parameter is not a valid membership condition element.
Implements:
ISecurityPolicyEncodable.FromXml

Return to top


Overridden Method: GetHashCode()
Summary
Gets the hash code for the current membership condition.
C# Syntax:
public override int GetHashCode();
Return Value:
The hash code for the current membership condition.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: ToString()
Summary
Creates and returns a string representation of the membership condition.
C# Syntax:
public override string ToString();
Return Value:
A string representation of the membership condition.
Implements:
IMembershipCondition.ToString

Return to top


Overloaded Method: ToXml()
Summary
Creates an XML encoding of the security object and its current state.
C# Syntax:
public SecurityElement ToXml();
Return Value:
An XML encoding of the security object, including any state information.
Implements:
ISecurityEncodable.ToXml

Return to top


Overloaded Method: ToXml(
   PolicyLevel level
)
Summary
Creates an XML encoding of the security object and its current state with the specified PolicyLevel.
C# Syntax:
public SecurityElement ToXml(
   PolicyLevel level
);
Parameters:

level

The PolicyLevel context, used to resolve NamedPermissionSet references.

Return Value:
An XML encoding of the security object, including any state information.
Implements:
ISecurityPolicyEncodable.ToXml

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.