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();
}
}