Hi - I'm trying to add a user using the code below, but I'm getting UserCreateStatus return as UnknownError, and seeing an error log - does anyone see what's wrong here.. I must be missing something in creating a new user. Thank!, Jay
Method: DotNetNuke.Security.Membership.AspNetMembershipProvider.CreateUser
StackTrace:
Message: System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Security.Membership.AspNetMembershipProvider.CreateUser(UserInfo& user)
//if user doesn't exist - add new dnn user
UserInfo newuser =
new
UserInfo();
newuser.Profile.InitialiseProfile(_portalId);
newuser.PortalID = _portalId;
newuser.IsSuperUser =
false
;
newuser.DisplayName = customer.FirstName +
" "
+ customer.LastName;
newuser.FirstName = customer.FirstName;
newuser.LastName = customer.LastName;
newuser.Email = customer.EmailAddress;
newuser.Username = customer.AccountNumber;
newuser.Membership.CreatedDate = DateTime.Now;
newuser.Membership.Password =
"password"
;
//to do map password
newuser.Membership.UpdatePassword =
false
;
newuser.Membership.Approved =
true
;
UserCreateStatus status = MembershipProvider.Instance().CreateUser(
ref
user);
if
(status == UserCreateStatus.Success)
{
UserController.UserLogin(_portalId, user, PortalSettings.Current.PortalName, Request.ServerVariables[
"REMOTE_ADDR"
],
true
);
}