/// <summary> /// Deletes the account and related memebership/profile information. /// </summary> /// <param name="principalId">The principal id.</param> public void DeleteAccount(Guid principalId) { Account acc = GetAccount(principalId); if (acc != null) { MembershipUser user = Membership.GetUser(new Guid(acc.ProviderKey)); if (user != null) { Membership.DeleteUser(user.UserName); } acc.Delete(); acc.AcceptChanges(); } }
/// <summary> /// Deletes the account and related memebership/profile information. /// </summary> /// <param name="providerKey">The providerKey.</param> public void DeleteAccount(string providerKey) { Account acc = GetAccount(providerKey); if (acc != null) { acc.Delete(); acc.AcceptChanges(); } MembershipUser user = Membership.GetUser(new Guid(providerKey)); if (user != null) { Membership.DeleteUser(user.UserName); } }