Display blocked user message on Membership

Asked

Viewed 187 times

1

I need to display a message when the blocked user tries to log in to Membership... I set the locked user with the Isapproved = false property; at the time of registration

MembershipUser lockUser = Membership.GetUser(txtEmail.Text);
lockUser.IsApproved = false;
Membership.UpdateUser(lockUser);

Is there any way?

  • How are you defining a user locked in the comic?

  • 1

    If you can explain better the problem you have in particular and, if possible, show code you have done where this problem is. Your question is too broad, see Help Center How to Ask.

  • I rephrased the question, I now need to display a message if the user has not unlocked the access that was sent by email.

1 answer

3

On your login button:

protected void Button1_Click(object sender, EventArgs e)
{
    MembershipUser user = Membership.GetUser("Yourusername");

    if(user != null && !user.isApproved) {
        ClientScript.RegisterStartupScript(
           this.GetType(), "myalert", "alert('O usuário não está aprovado.');", true);
    }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.