Sys.Services RoleService path 属性

更新:2007 年 11 月

获取或设置角色服务路径。

说明:

若要获取或设置客户端 API 属性的属性值,必须调用以 get_set_ 为名称前缀的属性访问器方法。例如,若要获取或设置属性 cancel 的值,需要调用 get_cancel 或 set_cancel 方法。

var profPath = Sys.Services.RoleService.get_path();
Sys.Services.RoleService.set_path(value); 

参数

参数

说明

value

一个包含角色服务路径的字符串。

备注

默认情况下,path 属性设置为空字符串。如果未设置 path 属性,则使用内部默认 ASP.NET 路径,该路径指向内置角色应用程序服务。

说明:

不能将内置角色应用程序服务移动到 ASP.NET 网站中的其他位置。但是,可以指向将相同方法和属性作为默认角色服务公开的自定义 Web 服务。

path 属性通常是在声明性标记中设置的。此值可以为绝对路径、相对路径或完全限定域名和路径。下面的示例演示如何以声明方式设置 path 属性。

<asp:ScriptManager>
  <RoleService 
    Path = "~/Myapp/MyRoleService.asmx"/>
</asp:ScriptManager>

示例

下面的示例演示如何使用 path 属性。此代码摘自 RoleService 类概述中的一个完整示例。

// This function gets the roles of the
// currently authenticated user. 
function ReadUserRoles() 
{
    // Clear the feedback output.
    DisplayInformation("");

    // You must load the user's roles 
    // first before you can use them.
    roleProxy.load();

    // Read the user's roles. 
    roles = roleProxy.get_roles();

}

请参见

概念

Sys.Services.AuthenticationService 类

Sys.Services.ProfileService 类