Creating username recovery functionality

Last post 05-16-2008 2:54 PM by dtromp. 2 replies.

Sort Posts:

  • Creating username recovery functionality

    05-15-2008, 5:57 PM
    • Loading...
    • dtromp
    • Joined on 05-08-2008, 2:05 PM
    • Posts 16

    As ASP.NET 2.0 comes only with a password recovery control, I decided to write a quick wizard which will allow the customer to recover his username. I wanted to use the FindUsersByName method for this but I cant get it to work. What am I doing wrong?

    Protected Sub WizardUserNameRecovery_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles WizardUserNameRecovery.FinishButtonClick
            Dim ObjUser As MembershipUserCollection = Membership.FindUsersByName(TextBoxEmailAddress.Text)
            label1.text = ObjUser.ToString
        End Sub

     (Yes I am a rookie :-))
     

  • Re: Creating username recovery functionality

    05-16-2008, 12:36 AM
    Answer
    • Loading...
    • nKognito
    • Joined on 03-06-2008, 5:11 AM
    • Posts 232

    First of all:

    FindUsersByName - Gets a collection of membership users where the user name contains the specified user name to match,

    so how do you want to find user's name if to use this function you NEED to know user's name :-)

    What you need is GetUserNameByEmail function:

     

    string username = Membership.GetUserNameByEmail(EmailTextBox.Text);
     
    May the force be with you
  • Re: Creating username recovery functionality

    05-16-2008, 2:54 PM
    • Loading...
    • dtromp
    • Joined on 05-08-2008, 2:05 PM
    • Posts 16

    Works perfectly, thanks!

    That command makes complete sense but I didnt even knew it existed. My fault.

Page 1 of 1 (3 items)