Membership.DeleteUser not working

Aug 12, 2013 at 11:38 AM
It seems, that this function is doing nothing.
After calling it with the UserName it is doing "nothing":
Looking into the Membership Collection it is still finding the user via RoboMongo...

Any other way to delete a user from the Membership database?
Coordinator
Aug 12, 2013 at 11:50 AM
DeleteAccount will work fine. Try it.

Delete user is clearing all fields that are connected to user, but not to account. In new membership we have two entities Account and User. YOu can havee account without user, so Delete User is just clearing properties of User collection. I combined User and Account in same collection.
Aug 12, 2013 at 12:10 PM
Thx for the fast reply.
I tried:
        var ret = Membership.Provider as MongoMembershipProvider;
        ret.DeleteAccount(username);
and it seems not to do anything. Looking into the "Users" Collection will show the entity...
Coordinator
Aug 12, 2013 at 12:15 PM
That is strange. I will take a look closely later today. As quick solution, you can implement UserProfileService and delete user using that service. More details here: https://extmongomembership.codeplex.com/wikipage?title=Extending%20User%20with%20own%20fields&referringTitle=Documentation

I will get back to you later today or tommorow.
Aug 13, 2013 at 7:03 PM
Thx.
Tried your quick solution, but somehow did not manage to get a db Connection up and running.

If you find the problem, give me a sign :)
Coordinator
Aug 13, 2013 at 9:26 PM
Hello,

I have fixed issue with deleting. So DeleteAccount would work now. Also another approach that i offered you was working as well. Please take a look at sample app. I have added sample code for deleting user with two approaches. Thanks for pointing to bug. I usually using second approach in my projects.

BTW: If you like project and want it keep supported. Please follow it :)

Regards,
Dmitriy.
Coordinator
Aug 13, 2013 at 10:03 PM
Just published to nuget and this is prerelease
Aug 14, 2013 at 5:55 AM
Thx for your fast Support. I will try it today :)