Groups > Application developers > Community Server Source discussions > Re: Create User Error




Create User Error

Create User Error
Thu, 12 Oct 2006 18:17:25 +000
I keep getting an error saying in the data provider at this line.

myCommand.Parameters.Add("@UserID", SqlDbType.UniqueIdentifier).Value
= upm.CurrentUser.Member.ProviderUserKey;
                     

There is no current user so it is Null.

 

Where is the GUID created when you create a user.

 

Here is my code......


 

        CommunityServer.Components.User u = new
CommunityServer.Components.User();

        u.Username = UserName;
        u.Password = password;
        u.Email = email;
        u.AccountStatus = UserAccountStatus.Approved;
    

        CreateUserStatus status;
        status = CommunityServer.Users.Create(u, false); 

 

I have been searching the forums and looking for stuff but couldn't find
anything....

 

Thanks,

John
Post Reply
Re: Create User Error
Thu, 12 Oct 2006 18:27:14 +000
Can you post the Stack Trace ?
Post Reply
Re: Create User Error
Thu, 12 Oct 2006 18:34:47 +000
Seems like I have to set IsAnonymous = false.

 

Can anyone explain this.  I would think IsAnonymous would have to be true.  This
is the code from the dataprovider

 

 public override User CreateUpdateDeleteUser(User user, DataProviderAction
action, out CreateUserStatus status) {

           UserProviderManager upm = new UserProviderManager(user);

            if(action == DataProviderAction.Create &&
!user.IsAnonymous)
                 upm.Create();
            else if(action == DataProviderAction.Update)
                upm.Update();
Post Reply
about | contact