SqlRoleProvider::GetAllRoles Method ()

 

Gets a list of all the roles for the application.

Namespace:   System.Web.Security
Assembly:  System.Web (in System.Web.dll)

public:
virtual array<String^>^ GetAllRoles() override

Return Value

Type: array<System::String^>^

A string array containing the names of all the roles stored in the database for a particular application.

Exception Condition
System.Configuration.Provider::ProviderException

An unknown error occurred while communicating with the database.

The GetAllRoles method is called by the Roles class to retrieve a list of all the roles in the SQL Server database specified in the ASP.NET application's configuration file (Web.config).

The following code example uses the GetAllRoles method to get the list of roles for an application and bind the results to a System.Web.UI.WebControls::GridView control. For an example of a Web.config file that enables role management, see SqlRoleProvider.

System_CAPS_security Security Note

This example contains a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: