Things to remember when using Membership.UpdateUser(MembershipUser user)

You got to love programming it thows you one curve ball efter another (c: thats why i love it so ,..
Her is a good thing to remember,.  when updating membership users, Lets say you want to do something like this

user.IsApproved = true;  //reactivate user
user.Comment = “mjau”; //change comment

this code will run just fine, but the result is not what you would expect
When it executes it will only update user.Comment = “mjau” on the other hand user.IsApproved will never be updated.
To make it work you must call Membership.UpdateUser() everytime you make an update, like this.

user.IsApproved = true;  //reactivate user

user.Comment = “mjau”; //change comment

Well,  that is my conclusion after some trail and error  runs

happy coding

Edit: Check out Sky Sanders Solution for this problem:


5 Responses to Things to remember when using Membership.UpdateUser(MembershipUser user)

  1. Sky says:

    Trial and error is not a reliable technique and your information is misleading.

    You might get some insight by using reflector.

    • maanehunden says:

      Thanks for the comments. I’ve taken your input in to advise, but sometimes googling for answers doesn’t result in a solution , so the next best thing is trial and error, which is also meant as a mean to test the code.
      No I don’t provide all the code but only a snipped which made the difference in my code.

  2. Sky says:

    Your conclusion is incorrect. You have other issues that are not apparent in this post.


    for more information

  3. Hi There,

    I don’t care if this blog posting is ‘wrong’, I worked for me. Thanks maanehunden!

    Bye for now

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: