How do delete registered users?

A

ascll

Greetings,

If the database already uploaded, anyway to delete certain users?

As far as I known, deleting users will affected at least 4 tables, which
is: -

- aspnet_Membership
- aspnet_Profile
- aspnet_Users
- aspnet_UsersInRoles

Any table I miss out?


Question
How do totally delete users with Username like '%test%' from all affected
tables?


Kindly advise.

Thanks
ascll
 
S

Steve

The easiest way to do this is via code in an ASP page, not SQL:
foreach (MembershipUser mu in Membership.GetAllUsers()) {
if (mu.UserName.IndexOf("test") >=0 ) {
Membership.DeleteUser(mu.UserName);
}
}

If you want to do this directly in SQL server, don't manually modify the
tables; instead, use the stored proc: aspnet_Users_DeleteUser.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top