This project has moved. For the latest updates, please go here.

Change Password control in sharepoint 2010 page not working.

Oct 10, 2012 at 8:24 PM
Edited Oct 10, 2012 at 8:24 PM

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.


Stack Trace:

[NotImplementedException: The method or operation is not implemented.]
   Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider.GetUser(String name, Boolean userIsOnline) +62
   System.Web.Security.MembershipProvider.GetUser(String username, Boolean userIsOnline, Boolean throwOnError) +35
   System.Web.UI.WebControls.ChangePassword.AttemptChangePassword() +169
   System.Web.UI.WebControls.ChangePassword.OnBubbleEvent(Object source, EventArgs e) +137
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
Coordinator
Oct 10, 2012 at 8:30 PM

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.