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 StartedCreating DotNetNuke users programmaticallyCreating DotNetNuke users programmatically
Previous
 
Next
New Post
9/26/2011 11:00 AM
 
Hi

I need to create an application that will create users within our DotNetNuke database. The application has to be a windows service so that it can run in the background. I've been trying to figure out how I could do this and reckon I need to be using the UserController, the problem I'm having though is that I keep getting the following error.

The type initializer for 'DotNetNuke.Security.Membership.MembershipProvider' threw an exception.

Can anyone point me in the direction of an example of how I can do this?

Thanks
Martin.
 
New Post
9/26/2011 10:16 PM
 
dotnetnuke.dll is designed to work in web applications so there are a lot of web specific (http) dependencies, meaning it's not really suited to be used by windows services. Another option would be to use web services which could be called from your service (see http://iweb.codeplex.com/ for an example of exposing webservices)

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
9/27/2011 5:34 AM
 
I'm trying now as suggested to create a webservice that will allow me to add a new user.

but I keep getting the following error:

System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Entities.Profile.ProfileController.GetUserProfile(UserInfo& objUser) at DotNetNuke.Entities.Users.UserInfo.get_Profile() at DotNetNuke.Entities.Users.UserInfo.set_FirstName(String Value) at LBDNNWebServices.Classes.User_Security.GetUserInfo() in C:\Inetpub\wwwroot\LBDNNWebServices\LBDNNWebServices\Classes\DNNUser.cs:line 86 at LBDNNWebServices.Classes.User_Security.CreateUser() in C:\Inetpub\wwwroot\LBDNNWebServices\LBDNNWebServices\Classes\DNNUser.cs:line 101 at LBDNNWebServices.Service1.AddDNNUser() in C:\Inetpub\wwwroot\LBDNNWebServices\LBDNNWebServices\Service1.asmx.cs:line 41

this happens every time I try to set a property on my UserInfo object.

i'm assuming that I'm doing something wrong when I create the UserInfo class.

Can anyone help?
Thanks
Martin.

 
New Post
9/27/2011 5:53 AM
 
to add some more detail to the above, i've noticed that when I create my membership provider using the following ...

private DotNetNuke.Security.Membership.MembershipProvider memberProvider = DotNetNuke.Security.Membership.MembershipProvider.Instance();

It's always null. Is this where my problem lies maybe?
 
New Post
9/27/2011 5:57 AM
 
no, that's likely just that the windows service is missing the necessary configuration parameters - see http://www.systemwidgets.com/Blog/tabid/61/articleType/ArticleView/articleId/138/categoryId/18/DotNetNuke-user-manager-Winform-App.aspx for an example

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedCreating DotNetNuke users programmaticallyCreating DotNetNuke users programmatically


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