Adding e-mail verification to the CreateUserWizard

Last post 01-07-2007 11:31 PM by Leijun Jie - MSFT. 2 replies.

Sort Posts:

  • Adding e-mail verification to the CreateUserWizard

    01-05-2007, 7:23 PM
    • Member
      100 point Member
    • Minaki
    • Member since 07-24-2004, 6:31 AM
    • Surrey, UK
    • Posts 21

    Hi,

     I am basically trying to implement an e-mail address verification into the CreateUserWizard, you know the ones that send you a verification code by e-mail and you have to enter that verification code before you log in...

    So far what I've done is to handle the CreatedUser event of the control and sent the user a randomly geneated code by e-mail, and then set IsApproved on the user to false. What I need to do now is store that verification code against the user somewhere. What's my best option for doing this? I've considered:

    • Modifying the database in some way to store the code, either append it to the aspnet_User or aspnet_Membership tables or by putting it in a new table... then manually connecting to the database and storing the valu
    • I also use the Profile provider, however the Profile of the user isn't available at the CreateUser stage, so I don't know how to set the value...
    • I was thinking of inheriting the MembershipUser class to add a ValidationCode field, but I don't see the point in that seeing as I'd still have to manualy connect to the database to get and set the verification code because the MembershipUser class doesn't expose anything to inheritors to help store information. (Am I trying to inherit from the wrong class here?)

    Can anyone give some advice? Or point me in the direction of a tutorial on this subject would be great!

     Many thanks,

    Alexia

    Minaki Serinde MCP
    http://www.minaki.co.uk
    http://www.inoxia.co.uk
  • Re: Adding e-mail verification to the CreateUserWizard

    01-06-2007, 11:20 AM
    Answer
    • Contributor
      3,964 point Contributor
    • Nullable
    • Member since 05-02-2006, 8:01 PM
    • Posts 740

    Profile is the way to go :)

    In your web.config where you define the profile, default the "IsApproved" boolean (that you create) to false... then when they click your like in the email (which goes to lets say "ConfirmMe.aspx"), you would do:

    private void Page_Load(object sender, EventArgs e)
    {
        // Get the profile based on the persons name... this can come from
        // the query string for all I care :)

        
    ProfileBase
    usersProfile = ProfileBase.Create("theUsersName", true);

        
    usersProfile.SetPropertyValue(
    "IsApproved", true);

        
    usersProfile.Save();

        // Why not auto log them in now too :)
        FormsAuthentication.SetAuthCookie("theUsersName");
    }

    Peace,

    (please mark this post as the answer if it answers your question) :)

    -Timothy Khouri
    http://www.SingingEels.com/
    Developer / Architect / Author
  • Re: Adding e-mail verification to the CreateUserWizard

    01-07-2007, 11:31 PM
    Answer
    The future is now...
    Sincerely,
    LeiJun Jie
    Microsoft Online Community Support
Page 1 of 1 (3 items)