MembershipProvider.DeleteUser(String, Boolean) 方法

定义

从成员资格数据源删除一个用户。Removes a user from the membership data source.

public:
 abstract bool DeleteUser(System::String ^ username, bool deleteAllRelatedData);
public abstract bool DeleteUser (string username, bool deleteAllRelatedData);
abstract member DeleteUser : string * bool -> bool
Public MustOverride Function DeleteUser (username As String, deleteAllRelatedData As Boolean) As Boolean

参数

username
String

要删除的用户的名称。The name of the user to delete.

deleteAllRelatedData
Boolean

如果为 true,则从数据库中删除与该用户相关的数据;如果为 false,则将与该用户相关的数据保留在数据库。true to delete data related to the user from the database; false to leave data related to the user in the database.

返回

如果用户被成功删除,则为 true;否则为 falsetrue if the user was successfully deleted; otherwise, false.

示例

有关MembershipProvider实现的示例,请参阅实现配置文件提供程序For an example of a MembershipProvider implementation, see Implementing a Profile Provider.

注解

采用用户名称作为输入,并从数据源中删除该用户的信息。Takes, as input, the name of a user and deletes that user's information from the data source. 如果deleteAllRelatedData Rolestrue,则还将删除存储在数据库中的、 ProfileWebPart个性化的所有用户数据。If deleteAllRelatedData is true, then all user data stored in the database for the Roles, Profile, and WebPart personalization is also deleted.

适用于

另请参阅