Using Roles Information with ASP.NET AJAX

ASP.NET roles enable you to group authenticated users and to treat each group as a unit. This can be useful for any action that applies to multiple users, such as enabling or denying access to resources on the server.

The Microsoft AJAX Library application role service enables you to access an authenticated user's roles from client script in an AJAX-enabled ASP.NET Web application. You can use the Microsoft AJAX Library application role service to perform role-based tasks by using client script. When the page runs, you can call the ECMAScript (JavaScript) RoleService proxy class, which is automatically generated by the application role service and downloaded to the browser.

This topic shows how to call the ASP.NET application role service from the browser by using JavaScript.

The following example shows how to use the role service from client script.

Note:

To run the example, make sure that there is at least one user defined in the application's membership database. For information about how to create a user in the default SQL Server Express Edition database, see Using Forms Authentication with ASP.NET AJAX.