Create user. Please, need advice on anonymous ...

S

shapper

Hello,

I am creating a user following the steps:

Get User Anonymous Profile > Create User > Create User Profile > Copy
Anonymous Profile to User Profile > Delete User Anonymous Profile >
Send Confirmation Email

The user needs to confirm it's email to approve the account by
visiting the URL that is sent by email.

Until the account has been confirmed the user cannot login.

This is my code:

MembershipCreateStatus status;
ProfileHelper anonymous = ProfileHelper.GetProfile();
MembershipUser user = Membership.CreateUser(username, password,
email, null, null, false, null, out status);

if (user != null) {
ProfileHelper profile = ProfileHelper.GetProfile(username);
profile.Visitor = anonymous.Visitor;
AnonymousIdentificationModule.ClearAnonymousIdentifier();
profile.Save();
MailHelper.SendConfirmationEmail
}

ProfileHelper is a custom profile provider that works as following:

- Get an user profile given the username: ProfileHelper.GetProfile
(username);

- Get current user profile (if anonymous get anonymous profile. If
authenticated gets the authenticated profile): ProfileHelper.GetProfile
();

I am having only one error:

System.NotSupportedException: ClearAnonymousIdentifier is not
supported when the feature is disabled or the user is anonymous.

On the following code line:

AnonymousIdentificationModule.ClearAnonymousIdentifier();

Could someone help me to solve this?

Thanks,

Miguel
 
S

shapper

Hello,

I am creating a user following the steps:

Get User Anonymous Profile > Create User > Create User Profile >  Copy
Anonymous Profile to User Profile > Delete User Anonymous Profile >
Send Confirmation Email

The user needs to confirm it's email to approve the account by
visiting the URL that is sent by email.

Until the account has been confirmed the user cannot login.

This is my code:

   MembershipCreateStatus status;
   ProfileHelper anonymous = ProfileHelper.GetProfile();
   MembershipUser user = Membership.CreateUser(username, password,
email, null, null, false, null, out status);

   if (user != null) {
     ProfileHelper profile = ProfileHelper.GetProfile(username);
     profile.Visitor = anonymous.Visitor;
     AnonymousIdentificationModule.ClearAnonymousIdentifier();
     profile.Save();
     MailHelper.SendConfirmationEmail
   }

ProfileHelper is a custom profile provider that works as following:

    - Get an user profile given the username: ProfileHelper.GetProfile
(username);

    - Get current user profile (if anonymous get anonymous profile. If
authenticated gets the authenticated profile): ProfileHelper.GetProfile
();

I am having only one error:

System.NotSupportedException: ClearAnonymousIdentifier is not
supported when the feature is disabled or the user is anonymous.

On the following code line:

AnonymousIdentificationModule.ClearAnonymousIdentifier();

Could someone help me to solve this?

Thanks,

Miguel

Please, anyone?

Thank You,
Miguel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top