Change Password control in sharepoint 2010 page not working

sharepoint2010
codeplex

#1

I am using the following control in the page and it asks for the "username, current password and then enter the new password. user does NOT have to be login to change password using this.

 <asp:ChangePassword ID="ChangePassword1" runat="server" OnChangedPassword="ChangePassword1_PasswordChanged"
        ChangePasswordTitleText="" CancelDestinationPageUrl="/" DisplayUserName="True"
        BorderPadding="4" Font-Names="Verdana" Font-Size="X-Small" SuccessPageUrl="/" FailureTextStyle-HorizontalAlign="Left"
        TextBoxStyle-Width="150">
    </asp:ChangePassword>

 

in code behind:

 protected void ChangePassword1_PasswordChanged(object sender, EventArgs e)
        {
            MembershipUser user = System.Web.Security.Membership.GetUser(ChangePassword1.UserName);
            user.IsApproved = true;
            Membership.UpdateUser(user);
           
        }
        //override the allow anonymous property to true
        protected override bool AllowAnonymousAccess
        {
            get
            {
                return true;
            }
        }
        protected override bool AllowNullWeb
        {
            get
            {
                return true;
            }
        }

Error message:

soon as i hit change password button, i get the following error message:

 

Exception Details: System.NotImplementedException: The method or operation is not implemented.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

#2

You can't use the actual ASP.Net membership controls as is on SharePoint, as all of the membership functions proxy through the SPClaimsAuthMembershipProvider, which doesn't fully implement all of the membership provider functions. There's also some conversion that has to happen for the claims based usernames.  For that reason I suggest you either use the Change Password web part from the FBA Pack, or at least use it as a base for your custom development.