If (ErrorCount > 3) And (LoginCtrl.PasswordRecoveryUrl <> String.Empty) Then

Response.Redirect(LoginCtrl.PasswordRecoveryUrl)

End If

End Sub

If you are planning to handle the event, you have to add your own code for validating the user name and password. The Authenticate event receives an instance of AuthenticateEventArgs as a parameter. This event argument class has a property called Authenticated. If you set this property to true, the Login control assumes that authentication was successful and raises the LoggedIn event. If set to false, it displays the FailureText and raises the LoginError event:

You have direct access to the entered values through the UserName and Password properties that contain the text entered in the corresponding text boxes. In case you are using template control and require the value of another control in addition to the controls with the IDs UserName and Password, you can use the control’s FindControl method to get the control. This method requires the ID of the control and returns an instance of System.Web.UI.Control. You then just cast the control to the appropriate type and read the values you require for your custom credential validation method. The following Login control uses a template with an additional control that you will use later in the Authenticate event in your code:

In the previous code example, the user’s key is an additional value that must be provided by the user for successfully logging in. To include this value into your credential validation process, you have to modify the contents of the Authenticate event as follows: