Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Login with email not UserName

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
andytidy@gmail.com - 31 Mar 2008 11:36 GMT
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?
andytidy@gmail.com - 31 Mar 2008 12:17 GMT
On Mar 31, 9:36 pm, andyt...@gmail.com wrote:
> 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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.