How do you update the aspnetdb membership IsApproved value?

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2010-06-16T11:22:01Z Indexed on 2010/06/16 11:22 UTC
Read the original article Hit count: 339

I need to update existing users IsApproved status in the aspnet_Membership table. I have the code below that does not seem to be working. The user.IsApproved property is updated but it is not saving it to the database table. Are there any additional calls I need to make?
Any suggestions? Thanks.

    /// <summary>
    /// Updates a users approval status to the specified value
    /// </summary>
    /// <param name="userName">The user to update</param>
    /// <param name="isApproved">The updated approval status</param>       
    public static void UpdateApprovalStatus(string userName, bool isApproved)
    {
       MembershipUser user = Membership.GetUser(userName);

       if (user != null)
           user.IsApproved = isApproved;          
    }

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc