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

HomeHomeDevelopment and...Development and...Getting StartedGetting StartedUsing DNN DLLS to create user in 5.6Using DNN DLLS to create user in 5.6
Previous
 
Next
New Post
2/3/2011 7:20 PM
 

I am developing an application that tracks a requisition for a new user and these requisitions are stored in a SQL database.

The requisition has a link to the user table.

When filling a requisiton I need to do 4 things.

Create a new user.
Record their Address in their profile
add the new user to one of 4 selected roles
update teh requisition table with the new user ID.

I would like to simplify the user experience by providing 1 screen to complete all 4 tasks.

The screen will have first and last name as well as address, city state and zip.

I will generate the user name and password from the first and last names.

I have added a reference to the DNN DLL and am trying to use the exposed objects and methods to do this correctly.

I have attempted to implement the following code to create the user and profile records:

Dim objmembership As New DotNetNuke.Entities.Users.UserMembership
Dim oUserInfo As New DotNetNuke.Entities.Users.UserInfo
Dim oprofile As New DotNetNuke.Entities.Users.UserProfile

oUserInfo.PortalID = 0
oUserInfo.IsSuperUser = False
oUserInfo.Username = FN.Value & LN.Value
oUserInfo.FirstName = FN.Value
oUserInfo.LastName = LN.Value
oUserInfo.DisplayName = FN.Value & " " & LN.Value
oUserInfo.Email = email.value

objmembership.Approved = True
objmembership.Password = FN.Value & LN.Value & "1"
oUserInfo.Membership = objmembership

oprofile.City = City.Value
oprofile.Street = Address1.Value
oprofile.PostalCode = Zip.Value
oprofile.Region = St.Value
oUserInfo.Profile = oprofile

Dim objUserCreateStatus As UserCreateStatus = DotNetNuke.Entities.Users.UserController.CreateUser(oUserInfo)

But I keep getting an nullreferenceexception error on the last line trying to generate then user creation status.

I have confirmed that oUserInfo, objmembership, and oprofile are all valid and referenceable.

All the examples I have seen are c# and I have done my best to convert them to vb.net
Also I am fairly new to using DNN so I don't know if I need anything else to be able to utilize the DLLs

I am developing this in Visual Web Developer express 2010 using vb.net and the error comes up when debuging in my test aspx page which is not launched through DNN so I am not actually logged into DNN when testing.

Don't know if that makes any difference, maybe the fact that there is no user to populate the created by user value?

Any help would be greatly appreciated.

Thanks in Advance

Eli Silverman
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedUsing DNN DLLS to create user in 5.6Using DNN DLLS to create user in 5.6


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