Why does Membership.ValidateUser() always return false?

安稳与你 提交于 2019-12-08 10:56:28

问题


I have an ASP.NET 2010 app. When I go through the registraiton process, I correctly get logged in. However, if I just try to log in later, ValidateUser always returns false'

blnSuccess = Membership.ValidateUser(strUserName, strPassword)

I've stepped through to ensure the correct username & password are being sent in and that this person is in the db (Express). Here's my Web.Config....All just regular stuff.

<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>

回答1:


Please take a look and see if this help you:

Membership.ValidateUser always returns false after upgrade to VS 2010 / .NET 4.0

Why might Membership.ValidateUser return false when the user is approved and is not locked out?



来源:https://stackoverflow.com/questions/4890026/why-does-membership-validateuser-always-return-false

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!