views:

22

answers:

2

I create a new user, approve them, then immediately attempt to authenticate with the credentials I just used to create the user...and get "false" back the Authenticate method.

string username = "me";
string password = "mypassword";
string email = "[email protected]";

Membership.CreateUser(username, password, email);

currentUser = Membership.GetUser(username);
currentUser.IsApproved = true;

bool isAuthenticated = FormsAuthentication.Authenticate(username, password);

I checked the database table -- the user is created with that username, password, and email. According to the database table, they are approved.

Yet, the Authenticate method still returns false.

A: 

You need to call the UpdateUser method after you change their approved status...

   Membership.UpdateUser(currentUser);

http://msdn.microsoft.com/en-us/library/system.web.security.membershipuser.isapproved.aspx

klabranche
Thanks, but no luck. We checked the database previously, and the Approved column in there has always indicated that they've been approved successfully.
Deane
A: 

Likely that the authentication mechanism is using a different data store under the covers that has yet to be cascade to.

dacracot