Why Does Membership Isapproved Set Itself to False?
I Have Some Users Where the Isapproved Column in the Database Is Set to False. This Means That They Can't Login. What Could Be the Reason That This Happens...
I have some users where the IsApproved column in the database is set to false. This means that they cant login.
What could be the reason that this happens, and how can I prevent IsApproved to be set to false automatically?
2 Answers
The MembershipUser.IsApproved Property details will clear you doubt regarding this.
Gets or sets whether the membership user can be authenticated. As like some administrator is moderating the website and it is false if your account has not yet been approved by the site's administrator. If he/she approves then it will set to true.
for more information, you should go through Examining ASP.NET's Membership, Roles, and Profile - Part 4 By Scott Mitchell
You can approve user by code as:
Dim User As MembershipUser
User = Nothing
User = Membership.GetUser("MyUsername")
If (User Not Nothing)
then
User.IsApproved = False
End If
Ref:
Make New User default to IsApproved = true
Error approving membership user
Unlocking and Approving User Accounts (C#)
protected void IsApproved_CheckedChanged(object sender, EventArgs e)
{
// Toggle the user's approved status
string userName = Request.QueryString["user"];
MembershipUser usr = Membership.GetUser(userName);
usr.IsApproved = IsApproved.Checked;
Membership.UpdateUser(usr);
StatusMessage.Text = "The user's approved status has been updated.";
}
Use MemberShip to manage this stuff. Hope this help..
The IsApproved column is set to false by default. There are different ways to change this default behaviour. See this link for changing.