配置活动目录成员身份

时间:2012-11-23 08:15:55

标签: asp.net .net active-directory membership-provider

我想使用成员资格类和用户Active目录作为数据源。我在web.config中配置了这样的

<connectionStrings>
<add name="ApplicationServices"
  providerName="System.Data.SqlClient" />
<add name="LDAPConnectionString" connectionString="LDAP://myserver"/>

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

但是当我想访问ASP.net WEB应用程序管理员时,我有这样的问题 “遇到错误。请返回上一页再试一次。”

3 个答案:

答案 0 :(得分:0)

您的connectionStringName似乎应设为"LDAPConnectionString"而不是"ApplicationServices"

答案 1 :(得分:0)

尝试这个(在确保连接字符串有效之前):

<membership>
  <providers>
    <clear/>
    <add name="AspNetSqlMembershipProvider" 
         type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
         connectionStringName="***ENTER CORRECT NAME OF YOUR CONN STRING" 
         enablePasswordRetrieval="false" 
         enablePasswordReset="true" 
         requiresQuestionAndAnswer="true" 
         applicationName="/" 
         requiresUniqueEmail="false" 
         passwordFormat="Hashed" 
         maxInvalidPasswordAttempts="5" 
         minRequiredPasswordLength="7" 
         minRequiredNonalphanumericCharacters="1" 
         passwordAttemptWindow="10" 
         passwordStrengthRegularExpression=""/>

  </providers>

</membership>

答案 2 :(得分:0)

您应该使用ActiveDirectoryMembershipProvider,而不是SqlMembershipProvider

链接的MSDN文章有一个示例配置。