Login.aspx.vb Code not functioning
My Login.aspx.vb page code is following. But When I enter wrong password then Redirect it to ("~/expirationmessage.aspx"), at the same time when I enter right password then it goes to default page.
****On the Other hand Response.Redirect("~/idlock.aspx") is not work though I enter wrong password above 5 times.
**** Another problem is when I try to login a user who already expired but can easily enter.
I m using Access Database. Please Help to solve the problem.
Protected Sub Login1_LoginError(ByVal sender As Object, ByVal e As System.EventArgs) Handles Login1.LoginError
'There was a problem logging in the user
'See if this user exists in the database
Dim userInfo As MembershipUser = Membership.GetUser(Login1.UserName)
Dim RenewDate = Profile.GetProfile(Login1.UserName).DateRenewed
If userInfo Is Nothing Then
'The user entered an invalid username...
'The password was incorrect (don't show anything, the Login control already describes the problem)
'See if the user is not approved
If Not userInfo.IsApproved Then
'See if the user is locked out
ElseIf userInfo.IsLockedOut Then
'Expiration of User
ElseIf DateDiff(DateInterval.Day, RenewDate, DateTime.Now) > 365 Then
Debug, debug, debug.
Let's deal with one problem at at time. First, the lock out problem. Is IsLockedOut set to true? When you enter an incorrect password, is FailedPasswordAttempCount correctly incremented in the database? Is FailedPasswordAttemptWindowStart correctly set to the current date/time? What are your settings for locking out an account in web.config?
Then, if all that data looks to be correct, and you even getting to that point in the code, or is the function exiting early even when the user is locked out?