1

I use WebSecurity to create my user's accounts.

var confirmationToken = WebSecurity.CreateUserAndAccount(model.Username, model.Password, 
                    new { Email = model.Email,
                        Lastname = model.Lastname,
                        Firstname = model.Firstname,
                        Birthday = model.Birthday,
                        Job = model.Job,
                        City = model.City,
                        Gender = model.Gender,
                        PictureFilename = "anonyme.png"
                }, true);

But how can i delete a user ?

4

1 回答 1

10
((SimpleMembershipProvider)Membership.Provider).DeleteAccount(userName); // deletes record from webpages_Membership table
((SimpleMembershipProvider)Membership.Provider).DeleteUser(userName, true); // deletes record from UserProfile table
于 2013-06-23T14:58:51.700 回答