Copied to clipboard

Flag this post as spam?

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


  • Bobi 280 posts 743 karma points
    Feb 25, 2020 @ 05:39
    Bobi
    0

    Login issues when restoring / copying db from server to localhost

    The admin accounts do not work when copying the server database to localhost. In an effort to copy the server database to the localhost, we use SSMS to create a backup on the server and then restore the database on the localhost using that backup. However, when this is done, no logins work on the localhost even though the website is working.

    I cannot login to the backend. I have tried using umbraco-admin-reset, but this is not working at all. Any ideas or other ways to copy the server database to the localhost without running into password/user issues?

    I also notice some other items do not carry over when restoring he database like this. Is there a better way / recommended way to copy a database from a server to another machine and not lose any data?

    Umbraco version = 7.4.10.

  • Joep 90 posts 688 karma points
    Feb 25, 2020 @ 08:15
    Joep
    0

    Hi,

    Are you using the same web.config file on localhost? Otherwise it could be that you have some different settings on the MembershipProvider.

    -Joep

  • Bobi 280 posts 743 karma points
    Feb 25, 2020 @ 15:32
    Bobi
    0

    I am using the same web.config file minus the connection strings for the server and other rules to force https instead of http, etc. I do notice that the Membership Provider settings are different for the localhost web.config. What should the Membership Provider look like for 7.10.4? My server web.config has the following, which works on the server:

    <membership defaultProvider="UmbracoMembershipProvider" userIsOnlineTimeWindow="15">
          <providers>
            <clear />
            <add name="UmbracoMembershipProvider" type="Umbraco.Web.Security.Providers.MembersMembershipProvider, Umbraco" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="10" useLegacyEncoding="false" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Member" passwordFormat="Hashed" allowManuallyChangingPassword="false" />
            <add name="UsersMembershipProvider" type="Umbraco.Web.Security.Providers.UsersMembershipProvider, Umbraco" />
          </providers>
    

    The Membership Provider on the localhost, which was working with the previous older database (until restoring/copying the server one to localhost) has the following, which does not work with the new database from server:

    <!-- Membership Provider -->
        <membership defaultProvider="UmbracoMembershipProvider" userIsOnlineTimeWindow="15">
          <providers>
            <clear />
            <add name="UmbracoMembershipProvider" type="Umbraco.Web.Security.Providers.MembersMembershipProvider, Umbraco" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="8" useLegacyEncoding="true" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Member" passwordFormat="Hashed" />
            <add name="UsersMembershipProvider" type="Umbraco.Web.Security.Providers.UsersMembershipProvider, Umbraco" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="8" useLegacyEncoding="true" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" passwordFormat="Hashed" />
          </providers>
        </membership>
    

    I was under the impression that useLegacyEncoding should be true, but the server one which works is set to false. I have no idea what this should look like for security, but also how to ensure I get into the backend?

  • Joep 90 posts 688 karma points
    Feb 25, 2020 @ 16:18
    Joep
    100

    Hi,

    You should either use the localhosts settings on both or the server settings on both to make sure it uses the same password encoding / hashing.

    -Joep

  • Bobi 280 posts 743 karma points
    Feb 25, 2020 @ 16:21
    Bobi
    0

    Thanks, so I just tested it out. There are two solutions:

    1) To use the exact same Membership Provider settings as the server in the localhost. This gets me into the backend.

    2) Or you can @Saba's method from this post https://our.umbraco.com/forum/using-umbraco-and-getting-started/100915-can-not-login-in-umbraco-backoffice-after-deployment-on-production to change the password to a known hash.

    However, Joep, if I am now using the Membership Provider settings in from the server, but I want to use Legacy Encoding (set it to true), how will I login after? It will likely kick me out...I want to ensure the security is updated.

  • Joep 90 posts 688 karma points
    Feb 25, 2020 @ 16:25
  • Bobi 280 posts 743 karma points
    Feb 25, 2020 @ 16:27
  • Patrick van Kemenade 65 posts 259 karma points
    Feb 25, 2020 @ 23:38
    Patrick van Kemenade
    0

    Have you tried creating a BACPAC using SSMS and importing that on the local server. I found this to be the easiest and relative fast way to do the backup and restore local (in a new DB).

  • Bobi 280 posts 743 karma points
    Feb 26, 2020 @ 01:35
    Bobi
    0

    I was thinking about this. Microsoft says that a restore is the most complete copy of a database, but I will try this instead.

Please Sign in or register to post replies

Write your reply to:

Draft