public sealed class UrlMembershipCondition : IMembershipCondition, System.Security.ISecurityEncodable, System.Security.ISecurityPolicyEncodable, IConstantMembershipCondition { // Public Constructors public UrlMembershipCondition(string url); // Public Instance Properties public string Url{set; get; } // Public Instance Methods public bool Check(Evidence evidence); // implements IMembershipCondition public IMembershipCondition Copy( ); // implements IMembershipCondition public override bool Equals(object o); // overrides object public void FromXml(System.Security.SecurityElement e); // implements System.Security.ISecurityEncodable public void FromXml(System.Security.SecurityElement e, PolicyLevel level); // implements System.Security.ISecurityPolicyEncodable public override int GetHashCode( ); // overrides object public override string ToString( ); // overrides object public SecurityElement ToXml( ); // implements System.Security.ISecurityEncodable public SecurityElement ToXml(PolicyLevel level); // implements System.Security.ISecurityPolicyEncodable }
The UrlMembershipCondition class uses Url evidence to determine if an assembly or application domain qualifies for membership of a CodeGroup. The Url property contains the URL required to qualify for membership and can include a wildcard as the final element for example, http://www.oreilly.com/apps/*. The value of the Url property is initially set in the UrlMembershipCondition constructor.
During policy resolution, the Check( ) method enumerates the provided Evidence collection and determines if it contains a Url evidence object. If so, UrlMembershipCondition tests for CodeGroup membership by comparing the string contained in its Url property with the URL contained in the Url.Value property.