Enterprize library change password RRS feed

  • Question

  • User-61363889 posted


    I'm new in enterprise library.

    I'm using the membership library to create a change password form in C#.s

    the changepassword method takes two parameters: old password and new password

    however, it doesn't throw any exception in case a user enters a Wrong old_password.

    I tried to get the current password for the current loged in  user so i can match it with the one entered, but i couldn't

    Do you guys have any suggestion to solve this issue?

    here is the code

                String _userName = Request["ID"];
                if   (!String.IsNullOrEmpty(_userName))
                    MembershipUser _user = Membership.GetUser(_userName);

        _user.ChangePassword(this.txtOldPassword.Text.Trim(), this.txtNewPassword.Text.Trim());
        this.lblerror.Visible = false;

            catch ( Exception ex)
                this.lblerror.Text  = ex.Message;



    Thank you



    Wednesday, June 25, 2008 1:25 PM

All replies

  • User1564875471 posted

    I'm not sure how this question related to Enterprise library ,

    ChangePassword method return a boolean value that indicate whether the password updated or not , so depending on that value , you can throw an exception

    if (_user.ChangePassword(this.txtOldPassword.Text.Trim(), this.txtNewPassword.Text.Trim())==false)

    throw new Exception(" Password doesn't changed ! ")


    Thursday, July 3, 2008 8:56 PM