locked
Cannot login with sqlmembership provider RRS feed

  • Question

  • User-1767698477 posted

    So I have integrated my site wth sqlmembership provider. I cannot login to any of the logins I created though. They are all Isapproved=true. I think it is the connection string. So in the tutorial it shows:

     <connectionStrings>
        <add name="SecurityTutorialsConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\SecurityTutorials.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
      </connectionStrings>
    
    And here is mine below. Should I have to modify the stored prodecure? Which one does it use to validate the username password?
    
    <add name="sqlConnectionString" connectionString="Connect Timeout=8; Initial Catalog=memberdbase; Data Source=DESKTOP-SBLF5UV\SQLEXPRESS;integrated security=true;" providerName="System.Data.SqlClient"/>

     <authentication mode="Forms">
          <forms slidingExpiration="true" timeout="60"/>
        </authentication>
        <machineKey decryption="AES" validation="SHA1" decryptionKey="153370BCFC4EFC97A541" validationKey="32CBA56E8624508A129"/>
           
        <!-- Configure the Sql Membership Provider -->
    
        <membership defaultProvider="MLASqlMembershipProvider">
          <providers>
            <!-- Add a customized SqlMembershipProvider -->
            <add
              name="MLASqlMembershipProvider"
              type="System.Web.Security.SqlMembershipProvider"
              connectionStringName="LocalSqlServer"
              enablePasswordRetrieval="false"
              enablePasswordReset="true"
              requiresQuestionAndAnswer="true"
              applicationName="MortgageLoanApply"
              requiresUniqueEmail="true"
              passwordFormat="Hashed"
              maxInvalidPasswordAttempts="5"
              minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1"
              passwordAttemptWindow="10"
              passwordStrengthRegularExpression=""/>
          </providers>
        </membership>
    
        <roleManager enabled="true"
                     defaultProvider="MLASqlRoleProvider"
                     cacheRolesInCookie="true"
                     createPersistentCookie="false"
                     cookieProtection="All">
          <providers>
       <add name="MLASqlRoleProvider" type="System.Web.Security.SqlRoleProvider" applicationName="MortgageLoanApply" connectionStringName="LocalSqlServer"/>
          </providers>
        </roleManager>

    Friday, May 8, 2020 6:08 AM

Answers

  • User475983607 posted

    How do I delete all the rows in all the membership tables and start this over.

    It just...

    DELETE FROM dbo.TheTableName

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 8, 2020 5:19 PM

All replies

  • User475983607 posted

    So I have integrated my site wth sqlmembership provider. I cannot login to any of the logins I created though. They are all Isapproved=true. I think it is the connection string.

    Basic troubleshooting.  The user table will not have records if the connection string is wrong.   Use SQL Management Studio to query the user table. 

    Use the Visual Studio debugger to step through the login code.  You have other posts with the same subject and were able to find the user and set the authentication cookie.  What changed?

    https://forums.asp.net/t/2166572.aspx

    https://forums.asp.net/t/2166614.aspx

     

    Friday, May 8, 2020 10:23 AM
  • User-1767698477 posted

    The role 'Processor' was not found. I think this is because I modified the naming in the web.config file for the membership provider and role provider.

    How do I delete all the rows in all the membership tables and start this over. There are foreign keys in numerous tables. I tried to rerun the aspnet_regsql.exe tool but that doesn't reinstall fresh tables.

    Friday, May 8, 2020 2:39 PM
  • User475983607 posted

    How do I delete all the rows in all the membership tables and start this over.

    It just...

    DELETE FROM dbo.TheTableName

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 8, 2020 5:19 PM
  • User-1767698477 posted

    Thanks. I have been very busy. I decided to start fresh again by repopulating my old dbase with the membership tables and I'm back on track again and able to login via membership.

    Saturday, May 9, 2020 7:49 PM