AuthorizationSection.Rules Eigenschaft

Definition

public:
 property System::Web::Configuration::AuthorizationRuleCollection ^ Rules { System::Web::Configuration::AuthorizationRuleCollection ^ get(); };
[System.Configuration.ConfigurationProperty("", IsDefaultCollection=true)]
public System.Web.Configuration.AuthorizationRuleCollection Rules { get; }
[<System.Configuration.ConfigurationProperty("", IsDefaultCollection=true)>]
member this.Rules : System.Web.Configuration.AuthorizationRuleCollection
Public ReadOnly Property Rules As AuthorizationRuleCollection

Eigenschaftswert

Ruft die AuthorizationRuleCollection von AuthorizationRule der AuthorizationSection.

Attribute

Beispiele

Das folgende Codebeispiel veranschaulicht die Verwendung der Rules.

 // Using the AuthorizationRuleCollection Add method.

 // Set the action property.
 authorizationRule.Action = 
    AuthorizationRuleAction.Allow;
 // Define the new rule to add to the collection.
 authorizationRule.Users.Add("userName");
 authorizationRule.Roles.Add("admin");
 authorizationRule.Verbs.Add("POST");

 // Add the new rule to the collection.
 authorizationSection.Rules.Add(authorizationRule);
' Using the AuthorizationRuleCollection Add method.
' Set the action property.
  authorizationRule.Action = _
  AuthorizationRuleAction.Allow
' Define the new rule to add to the collection.
authorizationRule.Users.Add("userName")
authorizationRule.Roles.Add("admin")
authorizationRule.Verbs.Add("POST")

' Add the new rule to the collection.
authorizationSection.Rules.Add(authorizationRule)

Hinweise

Die Rules von dieser Methode zurückgegebene Auflistung verweist nicht auf ein tatsächliches Element in der zugrunde liegenden Konfigurationsdatei. Es ist ein Konstrukt, das einfachen Zugriff auf die darin enthaltenen Regeln ermöglicht. Dies ist ein gängiges Muster für die Behandlung der Elemente einer Konfigurationsdatei.

Gilt für:

Weitere Informationen