阻止用户在createUserWizard上单击两次

时间:2014-11-15 06:03:24

标签: asp.net vb.net asp.net-membership

偶尔,我会以某种方式获得在asp.net web app中注册两次的用户。注册使用createUserwizard,用户和电子邮件设置为唯一,所以我没有任何线索,没有运气在另一篇文章中获得答案,所以我已经转移到另一种方式来解决这个问题。我想可能是来自用户点击“注册”'按钮两次靠近在一起。我一直在尝试许多解决方案,要么在点击后禁用按钮(这是字段验证的艰难b / c),要么弹出一个不说"创建用户',或者甚至只是将按钮文本更改为& #39;创建',像这样solution --with no luck (Rory's)。我没有得到这个错误,但没有按钮更改发生。这是我的向导(拿出EUA,chk box pass提示)

<WizardSteps>
    <asp:CreateUserWizardStep runat="server" ID="RegisterUserWizardStep" >
        <ContentTemplate>
            <p class="message-info">Passwords are required to be a minimum of <%: Membership.MinRequiredPasswordLength %> characters in length.</p>
            <p class="validation-summary-errors">
                <asp:Literal runat="server" ID="ErrorMessage" />
            </p>
            <fieldset>
                <legend>Registration Form</legend>
                <ol>
                    <li>
                        <asp:Label runat="server" AssociatedControlID="UserName">User name</asp:Label>
                        <asp:TextBox runat="server" ID="UserName" />
                        <asp:RequiredFieldValidator runat="server" ControlToValidate="UserName"
                            CssClass="field-validation-error" ErrorMessage="The user name field is required." />
                        <asp:RegularExpressionValidator runat="server" ControlToValidate="UserName"
                            CssClass="field-validation-error" ErrorMessage="No spaces or special characters" ValidationExpression="^[a-zA-Z0-9]+$" />
                    </li>
                    <li>
                        <asp:Label runat="server" AssociatedControlID="Email">Email address</asp:Label>
                        <asp:TextBox runat="server" ID="Email" TextMode="Email" />
                        <asp:RequiredFieldValidator runat="server" ControlToValidate="Email"
                            CssClass="field-validation-error" ErrorMessage="The email address field is required." />
                    </li>
                    <li>
                        <asp:Label runat="server" AssociatedControlID="Password">Password</asp:Label>
                        <asp:TextBox runat="server" ID="Password" TextMode="Password" />
                        <asp:RequiredFieldValidator runat="server" ControlToValidate="Password"
                            CssClass="field-validation-error" ErrorMessage="The password field is required." />
                    </li>
                    <li>
                        <asp:Label runat="server" AssociatedControlID="ConfirmPassword">Confirm password</asp:Label>
                        <asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" />
                        <asp:RequiredFieldValidator runat="server" ControlToValidate="ConfirmPassword"
                             CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The confirm password field is required." />
                        <asp:CompareValidator runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword"
                             CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The password and confirmation password do not match." />
                    </li>
                </ol>
                <asp:Button ID="registerBtn" runat="server" CommandName="MoveNext" Text="Register" " />
            </fieldset>
        </ContentTemplate>
        <CustomNavigationTemplate />
    </asp:CreateUserWizardStep>
</WizardSteps>

任何防止这次x2点击的帮助都会非常感激 - 当我得到&#34; [user]键已经存在时,它会一直打破我使用asp控制台工具的能力&#34;错误。

1 个答案:

答案 0 :(得分:0)

点击一次后可以禁用按钮吗?

Public Class _Default
    Inherits Page
    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Button1.Enabled = False
        MsgBox("Next time you click, the button is disabled, and you don't get this message.")
    End Sub
End Class