c# - Problem with login control -
c# - Problem with login control -
<asp:login id="login1" runat="server" failuretext="חיבורך לא הייה מוצלח. אנא נסה שנית" loginbuttontext="התחבר" passwordlabeltext="סיסמה:" passwordrequirederrormessage="יש צורך בסיסמה" remembermetext="זכור אותי פעם הבאה" titletext="" usernamelabeltext="שם משתמש:" usernamerequirederrormessage="יש צורך בשם משתמש" height="100px" destinationpageurl="~/allquestions.aspx" passwordrecoverytext="שכחת סיסמה" passwordrecoveryurl="~/retrievepassword.aspx" remembermeset="true" onauthenticate="login1_authenticate"> <checkboxstyle height="50px" /> <validatortextstyle bordercolor="#cc0000" /> </asp:login>
the command works without part: onauthenticate="login1_authenticate" part included, wont allow me login!!!
i dont know why though :(
protected void login1_authenticate(object sender, authenticateeventargs e) { if (usefulstaticmethods.checkifuserisbanned(login1.username)) { server.transfer("~/banned.aspx"); } }
you need se authenticated flag. msdn authenticateeventargs
authenticated:
gets or sets value indicating whether user's authentication effort succeeded.
you need add together code:
protected void login1_authenticate(object sender, authenticateeventargs e){ if (usefulstaticmethods.checkifuserisbanned(login1.username)) { e.authenticated = false; server.transfer("~/banned.aspx"); }else{ //authenticate... e.authenticated = true; } } c# asp.net login
Comments
Post a Comment