Copied to clipboard

Flag this post as spam?

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


  • Matt Bliss 176 posts 234 karma points c-trib
    Feb 02, 2012 @ 17:12
    Matt Bliss
    0

    Exception thrown on creating a new member

    I'm using Umbraco 4.7.1 and want to create a new member from within my code.

    on the trigger of an event I am calling the Membership.CreateUser with valid parameters

    Membership.CreateUser(userName, password, email);

    but the function generates a Null refererece exception further down the stack.

    [NullReferenceException: Object reference not set to an instance of an object.]
       umbraco.cms.businesslogic.Content.CreateContent(ContentType ct) +130
       umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String LoginName, String Email, MemberType mbt, User u) +676
       umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String Email, MemberType mbt, User u) +35
       umbraco.providers.members.UmbracoMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +122
       System.Web.Security.Membership.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +444
       System.Web.Security.Membership.CreateUser(String username, String password, String email) +53
       GFO.MemberHelper.CreateNewMember(String userName, String password, String email, String firstName, String lastName) +659
       GFO.TeaCommerceEvents.WebshopEvents_BeforeMailSend(Order arg1, MailMessage arg2, EmailTemplate arg3) +634
       TeaCommerce.Data.EmailTemplate.Send(Order order, EmailTemplateType emailTemplateType) +1152
       TeaCommerce.Admin.Umbraco.plugins.TeaCommerce.Orders.EditOrder.BtnSendEmail_Click(Object sender, EventArgs e) +181
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3707

    What would be causing this?

    Thanks,

    Matt

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 02, 2012 @ 17:28
    Tom Fulton
    4

    Hi Matt,

    Try checking your web.config and make sure you have a valid defaultMemberTypeAlias on your membership provider (system.web/membership - on UmbracoMembershipProvider).  If it's not valid you'll get the above exception.  I think it's this bug on codeplex.

    HTH,
    Tom

  • Rodion Novoselov 694 posts 859 karma points
    Feb 02, 2012 @ 17:37
    Rodion Novoselov
    0

    Hi. Are all parameters of your first call set to not null?

  • Matt Bliss 176 posts 234 karma points c-trib
    Feb 02, 2012 @ 17:40
    Matt Bliss
    0

    Thanks Tom,

    Spot on, I had been sloppy and missed the defaultMemberTypeAlias!

    Thanks,

    Matt

     

  • Rodion Novoselov 694 posts 859 karma points
    Feb 02, 2012 @ 17:47
    Rodion Novoselov
    3

    If you have only one member type defined at all - then you can just remove this parameter from the web.config completely - in this case this member type will be picked up for a new member automatically.

  • Matt Bliss 176 posts 234 karma points c-trib
    Feb 02, 2012 @ 17:52
    Matt Bliss
    0

    Thanks Rodion, I didn't know you could do that

Please Sign in or register to post replies

Write your reply to:

Draft