RoleProvider.DeleteRole Method

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

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

public:
virtual bool DeleteRole (
	String^ roleName, 
	bool throwOnPopulatedRole
) abstract
public abstract boolean DeleteRole (
	String roleName, 
	boolean throwOnPopulatedRole
)
public abstract function DeleteRole (
	roleName : String, 
	throwOnPopulatedRole : boolean
) : boolean
Not applicable.

Parameters

roleName

The name of the role to delete.

throwOnPopulatedRole

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

Return Value

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 or if it is a null reference (Nothing in Visual Basic) or 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.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: