简体   繁体   English

asp.net登录控件中的验证问题

[英]validation problem in asp.net login control

I have asp.net login control in my web application. 我的Web应用程序中有asp.net登录控件。 I used the following code. 我用下面的代码。

<asp:Login ID="LoginControl" runat="server" Width="351px" CssClass="login" 
        PasswordRequiredErrorMessage="You must enter a Password."
        UserNameRequiredErrorMessage="You must enter a Username."
         FailureText="Incorrect Username/Password"  
     EnableTheming="true" TitleText="Login into Focus/Career Status Viewer"  
     Height="164px" onauthenticate="LoginControl_Authenticate"   
         DisplayRememberMe="False" 
         UserNameLabelText="Username:" Font-Names="Arial" FailureTextStyle-Wrap="False" FailureAction="RedirectToLoginPage">
    <TextBoxStyle  CssClass="login-textbox" Font-Names="Arial" />
    <LoginButtonStyle  CssClass="login-button" />
   <ValidatorTextStyle Font-Names="Calibri" />
 <TitleTextStyle  CssClass="login-title"/>

</asp:Login>
     <br />
     <br />

<asp:ValidationSummary id="LoginValidationSummary"  
                        runat="server"  ShowSummary="true" 
         ValidationGroup="LoginControl" Height="44px" Width="471px"  >
                    </asp:ValidationSummary>

When I give the incorrect username and password and click the login button the failure text will appeared. 当我输入了错误的用户名和密码并单击“登录”按钮时,将出现故障文本。 Then clear the password field then click the login button both failure text and passwordrequirederrormessage validation messages will appeared. 然后清除密码字段,然后单击登录按钮,将同时显示失败文本和密码要求的错误消息验证消息。 But I need only the password requirederrormessage will appeared. 但是我只需要密码requirederrormessage就会出现。 Can anyone able to give the solution for that. 任何人都可以为此提供解决方案。 Thank you 谢谢

您总是可以解决它,并使用单独的Asp:RequireFieldValidator和模板化的Asp:Login

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM