Removes a role from the role database.
Assembly: System.Web (in System.Web.dll)
public: virtual bool DeleteRole( String^ roleName, bool throwOnPopulatedRole ) override
- Type: System::String
The name of the role to delete.
- Type: System::Boolean
If true, throws an exception if roleName has one or more members.
Return ValueType: System::Boolean
true if the role was successfully deleted; otherwise, false.
roleName is nullptr (Nothing in Visual Basic).
roleName is an empty string or contains a comma.
roleName is longer than 256 characters.
roleName has one or more members and throwOnPopulatedRole is true.
An unknown error occurred while communicating with the database.
The method is called by the Roles class to delete a role from the SQL Server database specified in the ASP.NET application's configuration file (Web.config). When a role is deleted, the list of users associated with that role is also deleted from the database. The user information in the database is not affected.
If throwOnPopulatedRole is true, then an exception will be thrown and the role will not be deleted if the role identified by the roleName parameter has one or more members. If throwOnPopulatedRole is false, then the role will be deleted whether it is empty or not.
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.