Can't add a user in ASP.Net

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
Vnsmith5
Ensign (ENS)
Ensign (ENS)
Posts: 4
Joined: Thu Dec 11, 2008 3:45 pm

Can't add a user in ASP.Net

Post by Vnsmith5 » Mon Feb 16, 2009 12:12 pm

I'm having a problem adding a user in ASP.Net, but outside of ablecommerce.
here's the code below:
Try
Dim jonesy As New System.Web.Security.MembershipCreateStatus
Dim newUser As User = UserDataSource.CreateUser(txtUserName.Text.Trim, txtPassword.Text.Trim, String.Empty, String.Empty, True, 0, jonesy)
Dim newuserGroup As New UserGroup(newUser.UserId, 10)
newUser.UserGroups.Add(newuserGroup)
newUser.IsApproved = True
newUser.Save()

If jonesy = Security.MembershipCreateStatus.Success Then
lblResult.Text = "User was successfully created!!!"
Else
lblResult.Text = "Process was unsuccessful! Please try again."
End If
Catch ex As Exception
lblResult.Text = ex.ToString
End Try

When I run this code, I get the following error:
System.NullReferenceException: Object reference not set to an instance of an object.
at CommerceBuilder.Configuration.TokenBase..ctor()
at CommerceBuilder.Common.Token..ctor()
at CommerceBuilder.Common.Token.get_Instance()
at CommerceBuilder.Users.UserDataSource.CreateUser(String email, String password, String passwordQuestion, String passwordAnswer, Boolean isApproved, Int32 affiliateId, MembershipCreateStatus& status)
at StorePasswordTest.Form1.Button1_Click(Object sender, EventArgs e) in C:\ProgTest\StorePasswordTest\StorePasswordTest\Form1.vb:line 48


any ideas?

Carolharry
Commander (CMDR)
Commander (CMDR)
Posts: 121
Joined: Wed Dec 17, 2008 9:13 am

Re: Can't add a user in ASP.Net

Post by Carolharry » Mon Feb 16, 2009 2:44 pm

Try removing
dim jonesy as new MembershipCreateStatus
to
dim jonesy as MembershipCreateStatus

Thanks
Carol

Vnsmith5
Ensign (ENS)
Ensign (ENS)
Posts: 4
Joined: Thu Dec 11, 2008 3:45 pm

Re: Can't add a user in ASP.Net

Post by Vnsmith5 » Mon Feb 16, 2009 3:21 pm

I tried that, and I still get the same message.
I think it's in the CreateUser line, but I can't find a solution.

Thanks for trying though!

Vnsmith5
Ensign (ENS)
Ensign (ENS)
Posts: 4
Joined: Thu Dec 11, 2008 3:45 pm

Re: Can't add a user in ASP.Net

Post by Vnsmith5 » Wed Feb 18, 2009 11:13 am

is there any other way to import users quickly into the AbleCommerce database?
Since, I can't figure out why I'm getting the above error, I'll need a new way to get the process done.

I'd like to be able to do it in VB.Net if at all possible.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Can't add a user in ASP.Net

Post by mazhar » Wed Feb 18, 2009 11:17 am

You can use DataPort tool to import users.
http://wiki.ablecommerce.com/index.php/ ... rt_Utility

Post Reply