我在项目中有CustomMembership类并在类中使用此代码:
private static int _MinRequiredPasswordLength;
public static int MinRequiredPasswordLength
{
set { _MinRequiredPasswordLength = value; }
get { return _MinRequiredPasswordLength; }
}
并在 web.config 中设置成员资格
<membership defaultProvider="CustomMembership">
<providers>
<clear />
<add name="CustomMembership" type="Project1.Code.CustomMembership, Project1, Version=1.0.0.0, Culture=neutral" connectionStringName="PConn" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
并使用此代码获取 minRequiredPasswordLength:
MinRequiredPasswordLength.Text = CMembership.MinRequiredPasswordLength.ToString();
但得到'0'!我想得到'6'。