I've searched StackOverflow and the DNN forums for this answer but did not find a working answer or explanation.
I need to lock a user account in DNN programmatically. We're using DNN version 8 and coding in C#.
UPDATE:
I was looking at the "User Accounts\Edit User Accounts" page and realized that there is no button to Lock an account. The account can only be Locked through multiple failed login attempts.
But once an account is Locked, I can now see a button to Unlock the account. So there has to be a way to call this programmatically no?
I tried setting:
User.Membership.LockedOut = false;
but that didn't work. No error just didn't Unlock the account.
Is there not some way to programmatically Unlock an locked account?
I figured out a backend way to unlock (lock does not work) a user account in DNN version 8.
This feature seems to be available in DNN version 9 but we are not able to upgrade for some reason that I can't control.
I had to write a sql command to get the UserId (GUID) from the aspnet_Users table and then using that I ran a sql update command to the aspnet_Membership table by setting IsLocked = 0 and FailedPasswordAttempCount = 0.
Hope that helps if someone is in the same situation.