Reputation: 196429
If I want to do an admin function like delete a user on the asp.net membership stuff that ships with the asp.net mvc sample.
I tried looking through the tables and realized that there was multiple tables that had rows added. I assume there must be a simpler way.
Upvotes: 2
Views: 588
Reputation: 14703
You can also use the ASP.NET Configuration Tool.
http://msdn.microsoft.com/en-us/library/ms998347.aspx - Step 3 shows how to add users. The same principle applies for deleting them. You can also mark them as inactive instead of deleting them. I usually mark them as inactive to preserve my database relationships.
Upvotes: 0
Reputation: 3963
In your Membership provider there is a method:
public bool DeleteUser(string username, bool deleteAllRelatedData)
If this is the standard asp.net membership provider that method runs a stored proc that cleans the user from your DB.
Here is some more examples: https://web.archive.org/web/20210304121422/https://www.4guysfromrolla.com/articles/091207-1.aspx
Upvotes: 6
Reputation: 56490
The Membership Provider base class has the methods you need. For example to delete a user you use the DeleteUser method. What you do NOT do is directly access the SQL database
Upvotes: 1
Reputation: 25339
Don't delete direct from the database, go through the membership provider and call the Membership.DeleteUser method.
Upvotes: 2
Reputation: 53115
Use the Membership API's.
To delete a user, use the Membership.DeleteUser method
Membership.DeleteUser(User.Identity.Name, true);
Upvotes: 2