This may not actually be an API question - my apologees if this is the wrong place for this question.
I'm trying to simply approve users as they are created. For some reason, IsApproved just refuses to be set to true. Before you say, "You have to call Membership.UpdateUser()" . . . I have already tried that. When I step through the code, IsApproved gets changed to true on the member object when I use mem.IsApproved = true, but then when I call Membership.UpdateUser(mem), it reverts to false. From everything I've read, this SHOULD work, so if you have any idea why it's NOT, I'd appreciate the insight.
1) The answer to your question is always extremely simple, and you will feel sheepish when you figure it out.
2) You WILL figure it out . . . immediately after you post your question.
I won't say this is entirely straight-forward, as I don't recall ever reading anything to this effect, but I should've been able to figure it out. The Member Type did not have a property called "approved" to reference by alias.
privatevoidEmailConfirmation(String userId){Int32 newUserId =Convert.ToInt32(userId);try{MembershipUser newUser =Membership.GetUser(newUserId);if(newUser !=null){ newUser.IsApproved=true;Membership.UpdateUser(newUser);// when this line of code execute, newUser.IsApproved = false. !!!}}catch(Exception){}}
Approving Members
This may not actually be an API question - my apologees if this is the wrong place for this question.
I'm trying to simply approve users as they are created. For some reason, IsApproved just refuses to be set to true. Before you say, "You have to call Membership.UpdateUser()" . . . I have already tried that. When I step through the code, IsApproved gets changed to true on the member object when I use mem.IsApproved = true, but then when I call Membership.UpdateUser(mem), it reverts to false. From everything I've read, this SHOULD work, so if you have any idea why it's NOT, I'd appreciate the insight.
Here's my code:
And the membership section of my web.config.
Incidentally, I am not sure whether I need both of those providers. They have both always been there, so I didn't mess with it.
Using Umbraco 4.7.2, Microsoft .NET 4.0, ASP.NET 4.0, and Visual Studio 2010.
Murphy's law regarding posting in forums:
1) The answer to your question is always extremely simple, and you will feel sheepish when you figure it out.
2) You WILL figure it out . . . immediately after you post your question.
I won't say this is entirely straight-forward, as I don't recall ever reading anything to this effect, but I should've been able to figure it out. The Member Type did not have a property called "approved" to reference by alias.
Please more describe your answer.
I have your problem, too.
My code:
is working on a reply...