I’m trying to give website admin ability to activate /deactivate or unlock multiple users by selecting users and clicking a button .
asp.net membership doesn’t have such method ( as far as I know ) . I don’t want to call UpdateUser() one time for each user .
any idea ?
In that case you will have to create a custom stored procedure to which you send a list of user names in a comma separated format and process them on the server. This will be slightly complex and ugly work because you will have to send Application name as well. For each user that your procedure processes call
aspnet_Membership_UnlockUserSP passing it apllication name (@ApplicationName) and user name (@UserName).Have a look at the logic of
aspnet_Membership_UnlockUserSP. Probably you can come up with a better solution.EDIT: Another solution would be to create a type through .NET assembly that works like a table with a list of usernames that you pass as UDF parameter to SqlCommand. On the server you would use this parameter to either join it with Jigar’s query or loop for each item in your type. That could be a better solution because you would be able to reuse the assembly for other such scenarios.