我被要求修复一个社区服务器论坛,在那里通过脚本创建了数千名用户。他们所有的个人资料页面都是针对处方药等的 SEOspam。该论坛没有对新注册用户使用电子邮件验证或管理员批准。我现在打开后者,但验证码会很好。
我的问题是批量删除这些帐户非常麻烦。我设置了一个 .net 网格(实际上是 Telerik Radgrid),以便我可以批量选择用户并单击删除。但是,以下代码似乎不起作用(请注意 VB nubbery):
Protected Sub rgUsers_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgUsers.NeedDataSource
rgUsers.DataSource = Users.GetUsers().Users()
End Sub
Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click
For Each item As GridDataItem In rgUsers.SelectedItems
Dim selectedUserID As Integer = item.OwnerTableView.DataKeyValues(item.ItemIndex)("UserID")
Dim userToDelete As CommunityServer.Components.User = Users.GetUser(selectedUserID, False) ' User is definitely populated. '
Dim username As String = userToDelete.Username
Dim deleteStatus As DeleteUserStatus = Users.DeleteUser(User)
Trace.Write(String.Format("Delete result for user {0}: {1}", username, deleteStatus.ToString)) ' Returns enum value 3 (Success.) '
Next
rgUsers.Rebind()
End Sub
UserDeleteStatus 结果返回“成功”,但实际上并未删除用户。我是否使用了正确的删除功能?非常感谢任何帮助,因为这对时间很敏感(客户不在市场上购买阴茎增大药。)