2011-08-27 87 views
1

我在我的web應用程序中有asp.net登錄控件。 我用下面的代碼。asp.net登錄控制驗證問題

<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> 

當我給出不正確的用戶名和密碼,然後單擊登錄按鈕失敗的文本將出現。然後清除密碼字段,然後單擊登錄按鈕會出現失敗文本和密碼驗證錯誤消息驗證消息。但我只需要密碼requirederrormessage就會出現。任何人都可以爲此提供解決方案。謝謝

+0

我不知道你做了什麼錯誤,如果你使用默認的登錄控制,那麼它應該完美按照你所說的 – Dotnet

回答

0

你總是可以解決它,並使用單獨的Asp:RequireFieldValidator和模板Asp:Login