RoleServiceManager.LoadRoles 属性

定义

获取或设置一个值,该值指示是否必须检索当前已登录用户的角色列表。Gets or sets a value that indicates whether the list of roles for the currently logged-on user must be retrieved.

public:
 property bool LoadRoles { bool get(); void set(bool value); };
public bool LoadRoles { get; set; }
member this.LoadRoles : bool with get, set
Public Property LoadRoles As Boolean

属性值

Boolean

如果必须检索角色列表,则为 true;否则为 falsetrue if the list of roles must be retrieved; otherwise, false. 默认值为 falseThe default is false.

注解

如果将 LoadRoles 属性设置为 true ,则类将使用方法来检索角色的列表 RoleServiceManager Roles.GetRolesForUserIf the LoadRoles property is set to true, the list of roles is retrieved by the RoleServiceManager class by using the Roles.GetRolesForUser method. 然后,将列表序列化为页标记。The list is then serialized into the page markup.

备注

LoadRoles 为时 true ,当前已验证身份的用户所属的所有角色都将发送到浏览器。When LoadRoles is true, all the roles that the current authenticated user belongs to are sent to the browser. 由于用户可能会看到角色信息,这可能是一个安全问题。Because users can potentially see the role information, this can be a security issue.

LoadRoles可以在 ScriptManager 控件或关联的控件中指定属性 ScriptManagerProxyThe LoadRoles property can be specified in the ScriptManager control or in an associated ScriptManagerProxy control. 如果 LoadRoles 代理实例的设置为,则将 true 检索角色的列表并将其添加到页面中。If LoadRoles is set to true for a proxy instance, the list of roles is retrieved and added to the page. 如果 LoadRolesfalse ,则不向页面标记添加角色。If LoadRoles is false, the roles are not added to the page markup. 在这种情况下,可以使用方法在浏览器中将角色信息存储在内存中。In that case, you can use the method to store role information in memory in the browser.

适用于

另请参阅