2012-05-03 120 views
4

我正在使用sql server和自定義數據庫來存儲成員資格提供程序表。在我的webconfig文件中,我降低了密碼強度,但成員仍然需要應用默認密碼強度。以下是webconfig設置Asp.net會員密碼

<membership> 
    <providers> 
    <add name = "AspNetSqlProvider" 
    type = "System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, 
    Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
    connectionStringName = "LocalSqlServer" 
    enablePasswordRetrieval = "false" 
    enablePasswordReset = "true" 
    requiresQuestionAndAnswer = "true" 
    applicationName = "/" 
    requiresUniqueEmail = "false" 
    passwordFormat = "Hashed" 
    maxInvalidPasswordAttempts = "5" 
    minRequiredPasswordLength = "6" 
    minRequiredNonalphanumericCharacters = "0" 
    passwordAttemptWindow = "10" 
    passwordStrengthRegularExpression = "" /> 
    </providers> 
</membership> 
+0

你會得到什麼錯誤信息? – Tuan

+0

密碼需要8個字符,至少包含一個大寫字母和一個字母數字字符。 –

回答

5

您需要將您的成員資格提供程序設置爲默認提供程序。否則它將使用Machine.Config中定義的成員資格提供者。

<membership defaultProvider="AspNetSqlProvider" userIsOnlineTimeWindow="30"> 
    <providers> 
    <clear/> 
    <add name = "AspNetSqlProvider" 
type = "System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
connectionStringName = "LocalSqlServer" 
enablePasswordRetrieval = "false" 
enablePasswordReset = "true" 
requiresQuestionAndAnswer = "true" 
applicationName = "/" 
requiresUniqueEmail = "false" 
passwordFormat = "Hashed" 
maxInvalidPasswordAttempts = "5" 
minRequiredPasswordLength = "6" 
minRequiredNonalphanumericCharacters = "0" 
passwordAttemptWindow = "10" 
passwordStrengthRegularExpression = "" /> 
    </providers> 
</membership>