This documentation is archived and is not being maintained.

Roles::RemoveUserFromRole Method

Removes the specified user from the specified role.

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

public:
static void RemoveUserFromRole(
	String^ username, 
	String^ roleName
)

Parameters

username
Type: System::String

The user to remove from the specified role.

roleName
Type: System::String

The role to remove the specified user from.

ExceptionCondition
System::ArgumentNullException

roleName is nullptr.

-or-

username is nullptr.

System::ArgumentException

roleName is an empty string or contains a comma (,)

username is an empty string or contains a comma (,).

System.Configuration.Provider::ProviderException

Role management is not enabled.

The RemoveUserFromRole method calls the default role provider to remove the specified user from the specified role at the data source.

The following code example removes a user from a role. For an example of a Web.config file that enables role management, see Roles.

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: