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?
Can't add a user in ASP.Net
-
- Commander (CMDR)
- Posts: 121
- Joined: Wed Dec 17, 2008 9:13 am
Re: Can't add a user in ASP.Net
Try removing
dim jonesy as new MembershipCreateStatus
to
dim jonesy as MembershipCreateStatus
Thanks
Carol
dim jonesy as new MembershipCreateStatus
to
dim jonesy as MembershipCreateStatus
Thanks
Carol
Re: Can't add a user in ASP.Net
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!
I think it's in the CreateUser line, but I can't find a solution.
Thanks for trying though!
Re: Can't add a user in ASP.Net
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.
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.
Re: Can't add a user in ASP.Net
You can use DataPort tool to import users.
http://wiki.ablecommerce.com/index.php/ ... rt_Utility
http://wiki.ablecommerce.com/index.php/ ... rt_Utility