Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

RoleProvider.DeleteRole Method

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

Namespace:  System.Web.Security
Assembly:  System.Web.ApplicationServices (in System.Web.ApplicationServices.dll)
abstract DeleteRole : 
        roleName:string * 
        throwOnPopulatedRole:bool -> bool

Parameters

roleName
Type: System.String

The name of the role to delete.

throwOnPopulatedRole
Type: System.Boolean

If true, throw an exception if roleName has one or more members and do not delete roleName.

Return Value

Type: System.Boolean
true if the role was successfully deleted; otherwise, false.

DeleteRole is called by the DeleteRole and the DeleteRole methods of the Roles class to delete the specified role from the data source for the configured 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 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 a null reference (Nothing in Visual Basic), or is an empty string, we recommend that your provider throw an exception.

The following code example shows a sample implementation of the DeleteRole method.

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

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.