AuthorizationRule.Users 属性

定义

获取与指定资源关联的用户。

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

属性值

StringCollection

一个包含用户的 StringCollection 集合,这些用户的授权必须进行验证。

属性

示例

下面的代码示例演示如何使用此属性。

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

注解

Users 属性是授予或拒绝对资源的访问权限的用户的列表。 属性集合或属性集合中Roles必须至少有一个值,或者必须同时存在这两个值Users

适用于