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?

1

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..

2

The IsApproved column is set to false by default. There are different ways to change this default behaviour. See this link for changing.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.