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)

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



The name of the user to delete.

Return Value

true if the user was deleted; otherwise, false.

Exception typeCondition


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


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