Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dominic Dore 18 posts 38 karma points
    Jun 24, 2011 @ 23:14
    Dominic Dore
    0

    Creating an Umbraco Member using Membership.CreateUser(), and attaching member to a Member type

    Hello all,

    I am trying to create a new Umbraco Member from var member = Membership.CreateUser(Email.Text, Password.Text); and first of all I am getting the following errors when this code is being executed:

       at umbraco.cms.businesslogic.Content.CreateContent(ContentType ct)

       at umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String LoginName, String Email, MemberType mbt, User u)

       at umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String Email, MemberType mbt, User u)

       at umbraco.providers.members.UmbracoMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status)

       at System.Web.Security.Membership.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status)

       at System.Web.Security.Membership.CreateUser(String username, String password)

       at HelloWorld.Registration.btnCreateUser_onclick(Object sender, EventArgs e) in C:\Users\ddore\Documents\Visual Studio 2010\Projects\HelloWorld\HelloWorld\Registration.ascx.cs:line 48

      Object reference not set to an instance of an object.

    I am not sure what the issue is, it seems that I cannot even create a member without an error. Secondly, once I am able to create this member, how do I connect the member type to it?

    Thanks in advance!

    - Dom

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Jun 25, 2011 @ 07:36
    Richard Soeteman
    0

    HI Dominic,

    You need  to set the defaultMemberTypeAlias to the Membertype you want to use on the UmbracoMembershipProvider section of your web.config file. Then it will work.

    Cheers,

    Richard

  • Dominic Dore 18 posts 38 karma points
    Jun 28, 2011 @ 22:38
    Dominic Dore
    0

    Thank you for your help Richard! My next question is: I have multiple custom properties that I am trying to assign to the new Member through the code behind. For instance, Address, Company, etc., which are all text boxes on the registration page. Is there any way that I can assign them in the code behind or are they meant to be assigned in the content management section only?

    Thanks in advance!

    - Dom

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 28, 2011 @ 23:01
    Tom Fulton
    0

    Hi,

    There are some other ways to do it, but I've been using the method described in this post and it works great (to access/update member properties):  http://www.aaron-powell.com/umbraco-members-profiles

    -Tom

  • ds 191 posts 223 karma points
    Jun 29, 2011 @ 08:49
    ds
    0

    Hi,

    There is also another good example which might help you at http://umbraco.miketaylor.eu/2010/08/29/authenticating-new-members/

Please Sign in or register to post replies

Write your reply to:

Draft