More in this section
Forums / Developing with Sitefinity / Sitefinity - Create UserMetadata with Api

Sitefinity - Create UserMetadata with Api

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Ricardo My Last name
    Ricardo My Last name avatar
    1 posts
    25 Feb 2010
    26 Feb 2010
    Link to this post

       I would be very pleased if someone could help me.
    Today, i had a problem. I made a webusercontrol wich represents
    a form where we can register users, that´s ok.
       The problem was that i needed to save some extra information on metadata. I watched some sitefinity demos that show me how can i do it  by adding keys on webconfig. I add that keys :

             <profile defaultProvider="Sitefinity">



                            <add name="Sitefinity" connectionStringName="DefaultConnection" applicationName="/" type="Telerik.DataAccess.AspnetProviders.TelerikProfileProvider, Telerik.DataAccess"/>




       <add name="IsCriovidaClient" type="Boolean"/>

                   <add name="AuthPessInfToBeUsed"/>


     Thereafter, i change user.aspx code that comes in sitefinity to accomplish the task, like i saw in video. Until that point everything is ok.
        Thereafter i tried to implement the same logic on my webusercontrol with no success, because i don´t know how have I to use sinefinity api to create this usermetadata info. It should be somethink similar to user.aspx create user event button code, but i cant see this code.
         So, I saw an object in sitefinity api called UsermetaInfo, and tried by this way, without any success :

            Here are my control variables:

          string nomeCompleto = String.Empty;


            string email = String.Empty;

            string password = String.Empty;

            string passwordConfirmacao = String.Empty;

            bool ? clienteCriova = null;

            bool ? authorizeInfo = null;


           And the code:



                MembershipCreateStatus sucessVar = MembershipCreateStatus.Success;

                MembershipUser user = Membership.Providers["Sitefinity"].CreateUser(txtNomeCompleto.Text,

                    txtPassword.Text, txtEmail.Text, null, null, true, null,out sucessVar);


                Telerik.DataAccess.AspnetProviders.UserMetaInfo userMetaInfo = new Telerik.DataAccess.AspnetProviders.UserMetaInfo();


                //fill userMetaInfo

                userMetaInfo.UserId = new Guid(user.ProviderUserKey.ToString());

                userMetaInfo.PropertyName = "AuthPessInfToBeUsed";

                userMetaInfo.Text = false.ToString();


                object o =  Nolics.ORMapper.Base.ObDataCache.Current;

                userMetaInfo.Create(null, Nolics.ORMapper.Base.OdbDataProvider.GetProvider("Sitefinity"),Nolics.ORMapper.Base.ObDataCache.Current);


    Despite of I can see in debug that all the parameters i have passed to function create are not null, i´ve got
    an exception

    object reference not set to an instance of an object

    The point is , Am I in the right direction to do what i want to do ?

    Is it done with this object UserMetaInfo, or how can i do it ?

    Sorry my bad english,
    I really will be very great if you can help me.

    Best regards,

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    26 Feb 2010
    Link to this post
    Hello Ricardo My Last name,

    You have to use ProfileBase Class and its methods.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
2 posts, 0 answered