AuthorizationSection.Rules Property
.NET Framework (current version)
Gets the AuthorizationRuleCollection of AuthorizationRule rules.
Assembly: System.Web (in System.Web.dll)
[ConfigurationPropertyAttribute("", IsDefaultCollection = true)] public AuthorizationRuleCollection Rules { get; }
Property Value
Type: System.Web.Configuration.AuthorizationRuleCollectionGets the AuthorizationRuleCollection of AuthorizationRule rules defined by the AuthorizationSection.
The Rules collection returned by this method does not refer to any actual element in the underlying configuration file. It is a construct that allows easy access to the rules it contains. This is a common pattern for handling the elements of a configuration file.
The following code example shows how to use the 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);
.NET Framework
Available since 2.0
Available since 2.0
Show: