DuplicateUserNameErrorMessage not working properly with CssFriendly?

Jan 8, 2010 at 3:25 PM

Hi,

I'm having a problem with the DuplicateUserNameErrorMessage. It seems that even though there is no other user with the same name, the user can still get an error message for this. I saw a thread with someone who had the same problem: http://cssfriendly.codeplex.com/Thread/View.aspx?ThreadId=54717. Apparently at that time no one had an answer, because there was no reply. I'm wondering if anyone has the answer now though, because I don't feel I know the adapters well enough to be able to troubleshoot the code myself to find this error...

The error is very frustrating since it gives the user the impression that someone else already has that user name, and yet he/she gets an e-mail saying that the registration went through (which it did because the login works after such a registration).

Any help would be greatly appreciated!

Regards,

Anders

Jan 10, 2010 at 10:57 AM

An addition to this problem is that I found out the problem only occurs in Internet Explorer, not Firefox (haven't tested other browsers for this problem).

So is this an IE bug? Does anyone know a way around it?

The problem is in the OnCreateUserError event handler in The CreateUserWizardAdapter. Even though there is no user with the name in question, the error duplicateuser is triggered. Why?:

protected void OnCreateUserError(object sender, CreateUserErrorEventArgs e)
        {
            _state = State.Failed;
            _currentErrorText = "An error has occurred. Please try again.";

            CreateUserWizard wizard = Control as CreateUserWizard;
            if (wizard != null)
            {
                _currentErrorText = wizard.UnknownErrorMessage;
                switch (e.CreateUserError)
                {
                    case MembershipCreateStatus.DuplicateEmail:
                        _currentErrorText = wizard.DuplicateEmailErrorMessage;
                        break;
                    case MembershipCreateStatus.DuplicateUserName:
                        _currentErrorText = wizard.DuplicateUserNameErrorMessage;
                        break;
                    case MembershipCreateStatus.InvalidAnswer:
                        _currentErrorText = wizard.InvalidAnswerErrorMessage;
                        break;
                    case MembershipCreateStatus.InvalidEmail:
                        _currentErrorText = wizard.InvalidEmailErrorMessage;
                        break;
                    case MembershipCreateStatus.InvalidPassword:
                        //_currentErrorText = wizard.InvalidPasswordErrorMessage;
                        _currentErrorText = String.Format(wizard.InvalidPasswordErrorMessage,
Membership.MinRequiredPasswordLength, Membership.MinRequiredNonAlphanumericCharacters);
                        break;
                    case MembershipCreateStatus.InvalidQuestion:
                        _currentErrorText = wizard.InvalidQuestionErrorMessage;
                        break;
                }
            }
        }

Regards,

Anders