Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Cannot create User programmaticallyCannot create User programmatically
Previous
 
Next
New Post
4/28/2015 5:24 AM
 

Hi!

 

We have a custom made CRM system, where our admin department creates user profiles for our customers. I made a webservice that creates those users into our DNN site (7.03.02). However I am experiencing a problem, where UserController.GetUserByName(PortalID, username) returns null, but when I am trying to create the user, I am getting "DuplicateUserName" error. I tried to clean asp_membership tables (user wasn't there), still same error.

 

Here is the parto of the code:

UserInfo newUser = UserController.GetUserByName(PortalID, username);

if (newUser == null)

{

return createDnnUser(PortalID, username, password);

}



private string createDnnUser(int PortalID, string uname, string upass)

{

UserInfo newUser = new UserInfo();

newUser.Username = uname;

newUser.DisplayName = uname;

newUser.Membership.Password = upass;

newUser.PortalID = PortalID;


UserCreateStatus rc = UserController.CreateUser(ref newUser);

if (rc == UserCreateStatus.Success)

{

addRoleToUser(newUser, "Subscribers", DateTime.MaxValue);

return "AllOk";

}

else

{

return rc.ToString();

}

}


 
New Post
4/30/2015 4:58 AM
 
Anyone?
 
New Post
4/30/2015 9:24 AM
 
I too have this issues
 
New Post
5/1/2015 3:12 AM
 

The DNN username must be unique across all DNN portals. Which one exception multi portal user

You can also create usernames in format username_{PortalID}, e.g. john_1

 
New Post
5/4/2015 3:17 AM
 

Since usernames are controlled by our CRM, they are unique accross all portals. So I do not believe this is the case. Something must happens here when creating the users, since sometime the user is created in asp_membership tables, but not in DNN tables.

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Cannot create User programmaticallyCannot create User programmatically


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out