0

我试图将属性添加到成员资格提供程序的“添加名称”部分,但 Intellisenxe 似乎不支持它们> 我想添加的一些属性是:

  1. minReqired非字母数字字符
  2. maxInvalidPasswordAttempts
  3. 需要唯一的电子邮件

下面是web.config。提前致谢。

<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
    <system.web>
        <compilation debug="true" targetFramework="4.0" />

      <roleManager enabled="true"
                 defaultProvider="CustomizedRoleProvider">
        <providers>
          <add name="CustomizedRoleProvider"
               type="System.Web.Security.SqlRoleProvider"
               connectionStringName="RestaurantDB" />
        </providers>
      </roleManager>

      <membership defaultProvider="CustomizedMembershipProvider">
        <providers>
          <add name="CustomizedMembershipProvider" 
               minRequiredPasswordLength="6" 
               type="System.Web.Security.SqlMembershipProvider"
               connectionStringName="RestaurantDB" />
        </providers>
      </membership>      
    </system.web>

  <appSettings>

  </appSettings>

  <connectionStrings>
    <add name="RestaurantDB" connectionString="data source=SFP\SFP_SQL_SVR;attachdbfilename=C:\Users\Susan\Documents\Databases\Restaurants.mdf;Integrated Security=SSPI;"/>
    <add name="RestaurantsEntities" connectionString="metadata=res://*/Restaurant.csdl|res://*/Restaurant.ssdl|res://*/Restaurant.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SFP\SFP_SQL_SVR;attachdbfilename=C:\Users\Susan\Documents\Databases\Restaurants.mdf;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>



</configuration>
4

1 回答 1

4

尝试这个:

<configuration>
        ...
        <system.web>
            ...
            
                <membership 
                 defaultProvider="SqlProvider" userIsOnlineTimeWindow="20">
                 <providers>
                    <clear/>
                    <add name="SqlProvider"
                        type="System.Web.Security.SqlMembershipProvider"
                        connectionStringName="LocalSqlServer"
                        enablePasswordReset="true"
                        requiresQuestionAndAnswer="false"
                        requiresUniqueEmail="false"
                        maxInvalidPasswordAttempts="5"
                        passwordAttemptWindow="10"
                        passwordFormat="Hashed"
                        minRequiredPasswordLength="7"
                        minRequiredNonAlphanumericCharacters="0"
                        passwordStrengthReqularExpression="0"
                        enablePasswordRetrieval="false"
                        applicationName="/" />
                </providers>
            </membership>
            ...
        </system.web>
        ...
    </configuration>
于 2012-05-02T15:27:34.703 回答