views:

46

answers:

1

I have an account called "admintest" which is "admin" as its role.
I called the following line to delete the user with deleteAllRelatedData=false because I just want to mark the user as deleted (I may need to retrieve users' history later)

bool result = Membership.DeleteUser("admintest", false);

After that, I call the following line to get the user:

string[] users = Roles.GetUsersInRole("admin");

But I still get "admintest" in the users array. What should I do?

+2  A: 

if you set deleteRelatedData = true, it will erase the use information from user and membership table, if set to false it will only delete information from membership table. In other words this method work for authentication but not for authorization. you should be calling RoleProvider.RemoveUsersFromRoles() method.

Igor Zelaya