i'm using the event below to change a default error message. so far i'm only using DuplicateUserName. my concern is the rest of the cases. i commented them all out so the errors would bubble up properly, then i uncommented them. i'm not sure what to do with them. leave them as is (all of the cases were auto-filled-in, btw, which is why they're there)? comment-out? delete the ones i'm not using? will the membership error(s) properly fire if all of these cases are here? i'm assuming they will because this is not an override but i'm really not sure. any advice on what to do with them?

    protected void RegisterUser_CreateUserError(object sender, CreateUserErrorEventArgs e)
    {
        switch (e.CreateUserError)
        {
            case MembershipCreateStatus.DuplicateEmail:
                break;
            case MembershipCreateStatus.DuplicateProviderUserKey:
                break;
            case MembershipCreateStatus.DuplicateUserName:
                RegisterUser.DuplicateUserNameErrorMessage = "Boo!";
                break;
            case MembershipCreateStatus.InvalidAnswer:
                break;
            case MembershipCreateStatus.InvalidEmail:
                break;
            case MembershipCreateStatus.InvalidPassword:
                break;
            case MembershipCreateStatus.InvalidProviderUserKey:
                break;
            case MembershipCreateStatus.InvalidQuestion:
                break;
            case MembershipCreateStatus.InvalidUserName:
                break;
            case MembershipCreateStatus.ProviderError:
                break;
            case MembershipCreateStatus.Success:
                break;
            case MembershipCreateStatus.UserRejected:
                break;
            default:
                break;
        }
    }

It's up to you what you do with the errors raised. If you comment or delete them, they will never be triggered. If you are sure they won't happen you can leave them out. If you are not, I'd combine all of them into one case so you can log them if they do happen.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.