When using the membership, user and roles providers, what is a
straight forward way to get users to login using an email address and
not a username?
OK, I just persisted on my search and found a simple enough answer:
Protected Sub AuthenticateLogin(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.AuthenticateEventArgs) Handles
Login1.Authenticate
'
Dim UserInfo As MembershipUser
Dim UserInfoColl As MembershipUserCollection
Dim sUserName As String
UserInfoColl = Membership.FindUsersByEmail(Login1.UserName)
sUserName = ""
For Each UserInfo In UserInfoColl
' Should only return one.
sUserName = UserInfo.UserName
Next
If Membership.ValidateUser(sUserName, Login1.Password) Then
e.Authenticated = True
Else
e.Authenticated = False
End If
End Sub
I'm sure there are better ways, and I will have a look at this later
(although any suggestions would be appreciated).
All I need to do now is find the best way to link this to my Staff
database.