Export (0) Print
Expand All

Membership.DeleteUser Method (String)

Deletes a user and any related user data from the database.

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

public:
static bool DeleteUser (
	String^ username
)
public static boolean DeleteUser (
	String username
)
public static function DeleteUser (
	username : String
) : boolean
Not applicable.

Parameters

username

The name of the user to delete.

Return Value

true if the user was deleted; otherwise, false.

Exception typeCondition

ArgumentException

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

ArgumentNullException

username is null.

User data stored in the database for the Roles, Profile, or WebPart personalization is also deleted when you are using the SqlRoleProvider, SqlProfileProvider, and SqlPersonalizationProvider objects for data storage.

The following code example deletes the currently logged-on user and all related data.

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:
© 2014 Microsoft