RoleServiceManager Class

Definition

配置角色服务的自定义实现的位置。Configures the location of a custom implementation of the role service.

public ref class RoleServiceManager
[System.ComponentModel.TypeConverter(typeof(System.Web.UI.EmptyStringExpandableObjectConverter))]
public class RoleServiceManager
type RoleServiceManager = class
Public Class RoleServiceManager
Inheritance
RoleServiceManager
Attributes

Remarks

RoleServiceManager 类对应于 ScriptManagerScriptManagerProxy 控件的 RoleService 属性。The RoleServiceManager class corresponds to the RoleService property of the ScriptManager or ScriptManagerProxy control.

启用了 AJAX 的应用程序使用该角色 Web 服务,通过使用异步 Web 服务调用检索当前经过身份验证的用户的角色信息。The role Web service is used by AJAX-enabled applications to retrieve role information for the current authenticated user by using an asynchronous Web service call. 您可以使用 RoleServiceManager 提供角色 Web 服务的备用实现的路径,而不是使用内置 Web 服务。You can use RoleServiceManager to provide the path of an alternative implementation of the role Web service instead of using the built-in Web service.

若要在你的应用程序中使用角色服务,你必须在配置文件中启用该角色服务,并在页中将其声明为。To use the role service in your application, you must enable it in the configuration file and declare it in the page. 如果使用内置的角色 Web 服务,则必须启用该服务,但不需要在页面中显式声明角色服务管理器。If you use the built-in role Web service, you have to enable it, but you do not have to explicitly declare the role service manager in the page.

若要创建自定义角色服务,必须实现具有两个方法的 Web 服务: GetRolesForCurrentUserIsCurrentUserInRoleTo create a custom role service, you must implement a Web service that has two methods: GetRolesForCurrentUser and IsCurrentUserInRole. 这些方法必须与内置角色 Web 服务的相应方法具有相同的签名。These methods must have the same signature as the corresponding methods of the built-in role Web service.

下面的示例演示必须在自定义角色 Web 服务类中实现的基本类结构。The following example shows the basic class structure that must be implemented in a custom role Web service class.

若要使用自定义角色 Web 服务,可以通过将 RoleService 元素放入 ScriptManager 控件中以声明方式在标记中添加服务,如下面的示例中所示。To use a custom role Web service, you can add the service declaratively in markup by putting a RoleService element inside the ScriptManager control, as shown in the following example.

<asp:ScriptManager ID="SM1" runat="server">  
  <RoleService Path="MyRoleService.asmx" LoadRoles="true" />  
</asp:ScriptManager>  

还可以通过编程方式将 Path 属性设置为使用自定义角色 Web 服务。You can also programmatically set the Path property to use a custom role Web service.

Constructors

RoleServiceManager()

初始化 RoleServiceManager 类的新实例。Initializes a new instance of the RoleServiceManager class.

Properties

LoadRoles

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

Path

获取或设置角色服务的路径。Gets or sets the path of the role service.

Methods

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also