Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Josip 189 posts 654 karma points c-trib
    Mar 25, 2020 @ 14:36

    Programaticaly change password

    How can i change members password?

    When I try this:

    if (System.Web.Security.Membership.ValidateUser(username, model.OldPassword))
                var memberService = Services.MemberService;
                var member = memberService.GetByUsername(username);
                memberService.SavePassword(member, model.NewPassword);
                return Redirect("/");

    I get this error: This provider does not support manually changing the password

    I know that i can set allowManuallyChangingPassword="true" on the UmbracoMembershipProvider, but is there any other way ?


  • Harikrishna Parmar 31 posts 207 karma points c-trib
    Mar 26, 2020 @ 16:33
    Harikrishna Parmar

    Please try this code block :

         var user = Members.CurrentUserName;
         if (Members.GetByUsername(user) != null)
             var services = Current.Services.MemberService;
             var servicesResult = services.GetByUsername(user);
             services.SavePassword(servicesResult, model.Password);

    or you can also try :

        if (Members.GetByEmail(model.Email) != null)
               var services = Current.Services.MemberService;
               var servicesResult = services.GetByEmail(model.Email);
               services.SavePassword(servicesResult, model.Password);            
Please Sign in or register to post replies

Write your reply to: