I have written a customer Register module and have a problem where, after I have added the new user using UserController.CreateUser as follows:-
With NewUserInfo
'Membership
.Membership.Username = UserName
.Membership.Email = Email
.Membership.Approved = True
.Membership.Password = Password
'DNN
.PortalID = PortalID
.Username = UserName
.FirstName = FirstName
.LastName = LastName
.Email = Email
.AffiliateID = DotNetNuke.Common.Utilities.Null.NullInteger
.DisplayName = DisplayName
End With
Users.UserController.CreateUser(NewUserInfo)
NewUserInfo.Profile.SetProfileProperty("FirstName", FirstName)
NewUserInfo.Profile.SetProfileProperty("LastName", LastName)
NewUserInfo.Profile.SetProfileProperty("CorporateID", "2")
Entities.Profile.ProfileController.UpdateUserProfile(NewUserInfo)
NewUserInfo.Membership.UpdatePassword = False
and then login to the portal with that new username as follows:-
UserController.UserLogin(PortalSettings.PortalId, NewUserInfo, PortalSettings.PortalName, ipAddress,
False)
Dim objUser As DotNetNuke.Entities.Users.UserInfo = UserController.GetCurrentUserInfoThat objUser.UserID will be -1, rather than the UserID of the new user just created. After moving to another page, DNN recognizes the new user login. I just want to know why it's not being recognized immediately after executing UserLogin.