Copied to clipboard

Flag this post as spam?

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


  • Eduardo 106 posts 130 karma points
    Sep 21, 2010 @ 11:27
    Eduardo
    0

    Error creating a new user

    Hi,

    I am trying to create a new user through an external web service. This service uses aspnet membership provider, the problem is that the service fails and returns this message:

    Referencia a objeto no establecida como instancia de un objeto(Object reference not set to an instance of an object). en umbraco.cms.businesslogic.Content.CreateContent(ContentType ct) en umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String LoginName, String Email, MemberType mbt, User u) en umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String Email, MemberType mbt, User u) en umbraco.providers.members.UmbracoMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) en System.Web.Security.Membership.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) en UserService.newuser(String strUserName, String strUserPassword, String strUserQuestion, String strUserAnswer, String strUserEmail)


    Web method:

    public string newuser(string strUserName, string strUserPassword,string strUserQuestion, string strUserAnswer, string strUserEmail)
        {
            string strResultado = string.Empty;

            MembershipCreateStatus status = new MembershipCreateStatus();

            try
            {
                var member = System.Web.Security.Membership.CreateUser(strUserName, strUserPassword, strUserEmail, strUserQuestion, strUserAnswer, true, out status);

                if (status == MembershipCreateStatus.Success)
                {
                    strResultado = "OK";
                }
                else
                {
                    strResultado = status.ToString();
                }
            }
            catch (Exception ex)
            {
                strResultado = ex.Message + ex.StackTrace;
            }
            finally
            {
                GC.Collect();
            }

            return strResultado;
        }


    I have got the necessary tables in my database, user has written accesses to the database.


    Thanks beforehand.

    Regards,

    Eduardo Macho

  • Sascha Wolter 615 posts 1101 karma points
    Sep 21, 2010 @ 12:12
    Sascha Wolter
    0

    Hi Eduardo,

    have a look at this post, it might contain your answer or point you in the right direction:

    http://our.umbraco.org/forum/developers/api-questions/11466-Dynamically-creating-new-members-in-Umbraco-45

    It also contains a link to Aaron's excellent blog(s) on members in Umbraco.

    Hope that helps,

    Sascha

  • Eduardo 106 posts 130 karma points
    Sep 21, 2010 @ 12:25
    Eduardo
    0

    Hi Sascha,

    Thank you for your prompt answer.

    Regards,
    Eduardo Macho

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies