0

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;
        }
    }
2
Contributors
1
Reply
11
Views
3 Years
Discussion Span
Last Post by pritaeas
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.