RemoveUserFromRole Method

Roles::RemoveUserFromRole Method (String^, String^)

 

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.

Exception Condition
System::ArgumentNullException

roleName is null.

-or-

username is null.

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.

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft