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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Code Coversion from DNN 3.3 to 4.3 (C#), problems with adding DNN usersCode Coversion from DNN 3.3 to 4.3 (C#), problems with adding DNN users
Previous
 
Next
New Post
8/25/2006 12:37 PM
 

Havent been able to figure how to add an DNN user, I went thru the forum and seen some VB code, but the same doesnt seem to work for me after I converted it to C#. If anyone has encoutered the same problem I would appreciate any help.

the following code:

UserInfo newUserInfo = new DotNetNuke.Entities.Users.UserInfo();

newUserInfo.Profile.InitialiseProfile(this.PortalId);

newUserInfo.PortalID = PortalId;

newUserInfo.Email = txtEmail.Text;

newUserInfo.Username = txtEmail.Text;

newUserInfo.FirstName = FirstName;

newUserInfo.LastName = LastName;

newUserInfo.DisplayName = FirstName + LastName;

newUserInfo.Membership.Approved = true;

newUserInfo.Membership.Password = txtPassword.Text;

newUserInfo.Profile.FirstName = FirstName;

newUserInfo.Profile.LastName = LastName;

UserCreateStatus userCreateStatus = new UserCreateStatus();

userCreateStatus = UserController.CreateUser(newUserInfo);

 

 

This will generate an error message that says:

DotNetNuke.Services.Exceptions.ModuleLoadException: c:\CMEWeb\DesktopModules\Learner\Register.ascx.cs(399): error CS1502: The best overloaded method match for 'DotNetNuke.Entities.Users.UserController.CreateUser(ref DotNetNuke.Entities.Users.UserInfo)' has some invalid arguments ---> System.Web.HttpCompileException: c:\CMEWeb\DesktopModules\Learner\Register.ascx.cs(399): error CS1502: The best overloaded method match for 'DotNetNuke.Entities.Users.UserController.CreateUser(ref DotNetNuke.Entities.Users.UserInfo)' has some invalid arguments at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings)

 

 

Alternatively I tried what I did on DNN 3.3:

 

UserController objUsers = new UserController();

int UserId = objUsers.AddUser(newUserInfo);

 

using AddUser instead of CreateUser, which gives me back the UserID on DNN3, but on DNN 4.3, I get a '-1' back everytime and can never successfully add the user

Any help appreicated

Thanks

 

 

 

 

 
New Post
9/22/2006 4:42 PM
 
Hi fabianc.
I had the same problem and the problem was the length of the password string passed as parameter. I thing password must be greater than 6 characters


 
New Post
9/22/2006 5:07 PM
 
that is because you must use the ref keyword.

userCreateStatus = UserController.CreateUser(ref newUserInfo);


 
New Post
7/21/2008 7:51 AM
 

I am having the same issue.

Just let me know, if u got any solution.

Regards,

Jesudas

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Code Coversion from DNN 3.3 to 4.3 (C#), problems with adding DNN usersCode Coversion from DNN 3.3 to 4.3 (C#), problems with adding DNN users


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