Cusotm Membership Provider - Custom Error Messages

Discussion in 'ASP .Net Security' started by Brett Ossman, Mar 12, 2009.

  1. Brett Ossman

    Brett Ossman Guest

    I am setting up a custom Membership Provider inheriting from
    SQLMembershipProvider. I overrode the ChangePassword method in my provider
    and first checks for password re-use. If I simply return False from my
    ChangePassword method, the ChangePassword control displays the standard
    ChangePasswordFailureText error message. I'm trying display a custom error
    message when a password was already used.

    Thanks

    Brett Ossman
     
    Brett Ossman, Mar 12, 2009
    #1
    1. Advertisements

  2. Brett Ossman

    Pipo Guest

    Hi Brett,

    You will have to change the ChangePasswordFailureText error message.

    Something like this? (Note the PassAlreadyInUse is a boolean you set on the
    inherited SQLMembershipProvider)

    protected void ChangePassword1_ChangePasswordError(object sender, EventArgs
    e)
    {
    if (mySQLMembershipProvider.PassAlreadyInUse)
    {
    ChangePassword1.ChangePasswordFailureText = "Password already in use";
    }
    }
     
    Pipo, Mar 18, 2009
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.