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

  • Thread starter Thread starter shapper
  • Start date Start date
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
 
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
 
Back
Top