为什么Membership.ValidateUser()总是返回false?

时间:2011-02-03 18:18:43

标签: asp.net-membership simplemembership

我有一个ASP.NET 2010应用程序。当我通过registraiton进程时,我正确登录。但是,如果我稍后尝试登录,则ValidateUser始终返回false'

blnSuccess = Membership.ValidateUser(strUserName, strPassword)

我已经介入以确保用户名&密码正在发送,并且此人在db(Express)中。这是我的Web.Config ....所有只是常规的东西。

<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>

<authentication mode="Forms">
<forms 
      name=".ASPXAUTH"
      loginUrl="~/Account/Login.aspx"
      protection="All"
      timeout="2880"
      slidingExpiration="true"
 />
</authentication>   
    <membership>
    <providers>
    <clear/>
    <add name="AspNetSqlMembershipProvider"
             type="System.Web.Security.SqlMembershipProvider" 
             connectionStringName="ApplicationServices" 
             enablePasswordRetrieval="false" 
             enablePasswordReset="true" 
             requiresQuestionAndAnswer="false" 
             requiresUniqueEmail="false" 
             maxInvalidPasswordAttempts="5" 
             minRequiredPasswordLength="6" 
             minRequiredNonalphanumericCharacters="0"
             passwordAttemptWindow="10" 
             applicationName="/"/>
    </providers>
    </membership>