Redigera

Dela via


AuthorizationRule.Users Property

Definition

Gets the users associated with the resource.

public:
 property System::Collections::Specialized::StringCollection ^ Users { System::Collections::Specialized::StringCollection ^ get(); };
[System.ComponentModel.TypeConverter(typeof(System.Configuration.CommaDelimitedStringCollectionConverter))]
[System.Configuration.ConfigurationProperty("users")]
public System.Collections.Specialized.StringCollection Users { get; }
[<System.ComponentModel.TypeConverter(typeof(System.Configuration.CommaDelimitedStringCollectionConverter))>]
[<System.Configuration.ConfigurationProperty("users")>]
member this.Users : System.Collections.Specialized.StringCollection
Public ReadOnly Property Users As StringCollection

Property Value

A StringCollection collection containing the users whose authorization must be verified.

Attributes

Examples

The following code example shows how to use this property.

 // 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)

Remarks

The Users property is a list of users that are granted or denied access to the resource. There must be at least one value in either the Users property collection or the Roles property collection, or both.

Applies to