After a user has been locked out, you must call the MembershipUser.UnlockUser() method to re-enable the user account. : Membership « Authentication Authorization « ASP.NET Tutorial






<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

    protected void btnRemove_Click(object sender, EventArgs e)
    {
        MembershipUser userToUnlock = Membership.GetUser(txtUserName.Text);
        if (userToUnlock == null)
        {
            lblMessage.Text = "User not found!";
        }
        else
        {
            userToUnlock.UnlockUser();
            lblMessage.Text = "Lock removed!";
        }
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Remove Lock</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <asp:Label
        id="lblUserName"
        Text="User Name:"
        AssociatedControlID="txtUserName"
        Runat="server" />
    <asp:TextBox
        id="txtUserName"
        Runat="server" />
    <asp:Button
        id="btnRemove"
        Text="Remove Lock"
        Runat="server" OnClick="btnRemove_Click" />
    <br />
    <asp:Label
        id="lblMessage"
        EnableViewState="false"
        Runat="server" />
    </div>
    </form>
</body>
</html>








21.11.Membership
21.11.1.Using ASP.NET Membership
21.11.2.Setting Up Your Web Site for Membership
21.11.3.Using the Membership Application Programming Interface
21.11.4.Use the methods of the Membership class to create custom Login controls.
21.11.5.Configure how passwords are stored by setting the passwordFormat attribute in the web configuration file.
21.11.6.Disable this requirement when using the SqlMembershipProvider.
21.11.7.Locking Out Bad Users
21.11.8.After a user has been locked out, you must call the MembershipUser.UnlockUser() method to re-enable the user account.
21.11.9.The web configuration file used to set up the XmlMembershipProvider
21.11.10.Creating users programmatically (C#)
21.11.11.Creating users programmatically (VB)
21.11.12.Membership provider settings in the machine.config file
21.11.13.Denying unauthenticated users