I need to lock a user account programmatically. We're using version 08.00.04 (226) and coding with C#.
I've search Google, StackOverflow, etc. but haven't been able to find a way to do this. Is this not possible in DNN?
Thanks
Thanks Will for the quick response. As for the upgrading it's above my pay grade but they're aware of the risks.
As for the options to set the IsDeleted/IsApproved properties, I have code that sets the IsApproved property and it works.
I assume that the option to directly set the "Locked Out" value that I see in the Edit User Account screen is not possible?
Anyone else have any idea how to do this or if it is even possible?
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.
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.