我的教科書指出,一個有效的密碼默認情況下,「要求你輸入至少七個字符其中一人是一個非字母數字。」我絕對是這麼做的。我收到的錯誤是,「提供的密碼答案是無效的。」提前ASP.Net成員資格提供:自定義創建用戶
protected void submit_Click(object sender, EventArgs e)
{
try
{
Membership.CreateUser(userName.Text, passwdConfirm.Text, email.Text);
}
catch (MembershipCreateUserException)
{
loginError.Text = "Password must be a minumum of 7 characters and contain at least one non-alphanumeric character";
}
}
感謝:這裏是在ASPX文件中的代碼:
<div id="loginBlock">
First Name: <asp:TextBox ID="fname" runat="server"></asp:TextBox>
Last Name: <asp:TextBox ID="lname" runat="server"></asp:TextBox><br />
Username: <asp:TextBox ID="userName" runat="server"></asp:TextBox><br />
Password: <asp:TextBox ID="passwd" runat="server" TextMode="Password"></asp:TextBox><br />
Confirm Password: <asp:TextBox ID="passwdConfirm" runat="server"
TextMode="Password"></asp:TextBox>
<asp:CompareValidator ID="validatePasswd" CssClass="vaidator" ControlToValidate="passwdConfirm" ControlToCompare="passwd" runat="server" ErrorMessage="Passwords don't match! Re-enter."></asp:CompareValidator><br />
Email: <asp:TextBox ID="email" runat="server"></asp:TextBox><br />
Confirm Email: <asp:TextBox ID="emailConfirm" runat="server"></asp:TextBox>
<asp:CompareValidator ID="validateEmail" CssClass="vaidator" ControlToValidate="emailConfirm" ControlToCompare="email" runat="server" ErrorMessage="Passwords don't match! Re-enter."></asp:CompareValidator><br />
<asp:Button ID="submit" runat="server" Text="JOIN" onclick="submit_Click" /><br /><br />
<asp:TextBox ID="loginError" CssClass="vaidator" runat="server" Width="300px" ReadOnly="True"
BorderStyle="None" Font-Size="0.9em" Rows="2"></asp:TextBox>
</div>
這裏是代碼隱藏按鈕單擊事件!
什麼是你的會員的配置樣子在你的web.config? –