ASP.Net Membership.DeleteUser

前端 未结 7 2036
感情败类
感情败类 2021-02-06 03:19

In testing, the user on a db i\'ve used was a big jefe. In production, he only has Execute.

When I called,

Membership.DeleteUser(user)

7条回答
  •  臣服心动
    2021-02-06 03:51

    I believe your 'REFERENCE' constraint is actually a Foreign key in the database that exists between the aspnet_Users table and the aspnet_UsersInRoles table. I would figure that the user you are trying, has it's UserId in both tables, and before you can remove it from the Users table, it has to be removed from the UsersInRoles table also.

    Have you tried http://msdn.microsoft.com/en-us/library/system.web.security.roleprovider.removeusersfromroles.aspx to ensure that all the roles are removed from this user? You could verify too by inspecting the rows of these two tables in the database.

提交回复
热议问题