Membership authentication fails inexplicably

35 Views Asked by At

I have a Web Forms application and for authentication I use Membership authentication. I reuse this part from another project from which I cloned the database, web.config, the login form. I use the same credentials for a login/user I know and in my application the login fails although there they work. Everything related to authentication seems the same in booth applications so I don't know what to check and how to debug this. I have just changed tolocalhost in web.config->authentication->forms->domain and this is the only difference. As far as I can tell Membership.ValidateUser() is not used/called. The application always enters OnLoginError(object sender, EventArgs e). The e argument is empty. The method OnLogginIn() does not do much.

I put bellow relevant content.

Login.aspx contains:

<form id="form1" runat="server" class="g-py-15">
    <uc1:ResultMessage ID="ResMsg" runat="server" />    
    <asp:Login ID="LoginUser" runat="server" RenderOuterTable="false"
            OnLoggingIn="OnLogginIn" OnLoggedIn="OnLoggedIn" OnLoginError="OnLoginError" >
        <LayoutTemplate>
            <div class="accountInfo" style="color: #000;">
                <asp:Literal ID="FailureText" runat="server"></asp:Literal>
            </div>
            <asp:ValidationSummary ID="LoginUserValidationSummary" runat="server" 
                                   CssClass="failureNotification" 
                    ValidationGroup="LoginUserValidationGroup"/>
            <div class="mb-4">
                <asp:TextBox ID="UserName" runat="server"
                             CssClass="form-control g-py-15" placeholder="Email" ></asp:TextBox>
            </div>
            <div class="g-mb-35">
                <asp:TextBox ID="Password" runat="server"
                             CssClass="form-control g-py-15" placeholder="Password"
                                                    TextMode="Password" ></asp:TextBox>
              <div class="row justify-content-between">
                <div class="col align-self-center">
                  <label class="form-check-inline u-check g-pl-25 mb-0">
                    <input ID="KeepSignedIn" runat="server" class="g-hidden-xs-up"  type="checkbox" />
                    <div class="g-left-0">
                      <i class="fa" data-check-icon="&#xf00c"></i>
                    </div>
                    Keep signed in
                  </label>
                </div>
              </div>
            </div>
            <div class="mb-4">
                 <asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In"
                             CssClass="btn btn-md btn-block u-btn-primary rounded g-py-13"/>    
            </div>
        </LayoutTemplate>
    </asp:Login>
</form>

web.config:

<authentication mode="Forms">
  <forms name=".localhost.klaus" loginUrl="~/Account/Login.aspx" protection="All"
         timeout="50" path="/" requireSSL="false" cookieless="UseCookies"
         domain="localhost" enableCrossAppRedirects="false" slidingExpiration="true"/>
</authentication>
<membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="25" hashAlgorithmType="">
  <providers>
    <clear/>
    <add connectionStringName="MyConnString"
         enablePasswordRetrieval="false"
         enablePasswordReset="true"
         requiresQuestionAndAnswer="false"
         applicationName="MyApp"
         requiresUniqueEmail="true"
         passwordFormat="Hashed"
         maxInvalidPasswordAttempts="25"
         passwordAttemptWindow="10"
         passwordStrengthRegularExpression=""
         minRequiredPasswordLength="4"
         minRequiredNonalphanumericCharacters="0"
         name="AspNetSqlMembershipProvider"
         type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c13f1f6a11d50c3b"/>
  </providers>
</membership>
0

There are 0 best solutions below