System.Web.Security.RoleProvider.DeleteRole Method

Removes a role from the data source for the configured applicationName.

Syntax

public abstract bool DeleteRole (string rolename, bool throwOnPopulatedRole)

Parameters

rolename
Documentation for this section has not yet been entered.
throwOnPopulatedRole
If true, throw an exception if roleName has one or more members and do not delete roleName.

Returns

true if the role was successfully deleted; otherwise, false.

Remarks

RoleProvider.DeleteRole(string, bool) is called by the Roles.DeleteRole(string) and the Roles.DeleteRole(string, bool) methods of the System.Web.Security.Roles class to delete the specified role from the data source for the configured RoleProvider.ApplicationName.

When you delete a role from the data source, ensure that you also delete any associations between a user name and the deleted role for the configured applicationName.

If throwOnPopulatedRole is true, and the role identified by the roleName parameter has one or more members, throw a System.Configuration.Provider.ProviderException and do not delete the role. If throwOnPopulatedRole is false, then delete the role whether it is empty or not.

If the specified role name does not exist, is null, or is an empty string, we recommend that your provider throw an exception.

Requirements

Namespace: System.Web.Security
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0