Share via


AuthorizationSection.Rules プロパティ

定義

AuthorizationRuleCollection 規則の AuthorizationRule を取得します。

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

プロパティ値

AuthorizationRuleCollection で定義されている AuthorizationRule 規則の AuthorizationSection を取得します。

属性

次のコード例は、 を使用する方法を 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)

注釈

このメソッドによって返されるコレクションは Rules 、基になる構成ファイル内の実際の要素を参照しません。 これは、含まれているルールに簡単にアクセスできるコンストラクトです。 これは、構成ファイルの要素を処理するための一般的なパターンです。

適用対象

こちらもご覧ください