SimpleRoleProvider.AddUsersToRoles Method

Adds the specified user names to the specified roles.

Namespace:  WebMatrix.WebData
Assembly:  WebMatrix.WebData (in WebMatrix.WebData.dll)

public override void AddUsersToRoles(
	string[] usernames,
	string[] roleNames


Type: System.String[]
The user names to add.
Type: System.String[]
The roles to add the names to.


One or more of the specified users already exists in one or more of the specified roles.

Even if you want to add only one user to one role, you must pass arrays to both the usernames and roleNames parameters.


If the WebSecurity.InitializeDatabaseConnection() method has not been called, and if you have configured your site to use the standard ASP.NET role provider, this method is passed through to the standard role provider. For more information, see the SimpleRoleProvider class overview.

  • Medium trust for the immediate caller. This member can be used by partially trusted code.