【问题标题】:Asp.net, Active Directory authentication not workingAsp.net,Active Directory 身份验证不起作用
【发布时间】:2009-12-10 06:02:26
【问题描述】:

我无法在我的网站上进行 AD 身份验证。我有以下可以正常工作的测试代码:

DirectoryEntry entry = new DirectoryEntry(srvr, usr, pwd);
object nativeObject = entry.NativeObject;

在我的网站上,我收到一条错误消息“您的登录尝试不成功。请重试。”。我真的无法弄清楚阻止登录的过程中的潜在错误是什么。

这是我的 web.config 中的部分:

<authentication mode="Forms">
    <forms loginUrl="Default.aspx" 
     timeout="30" 
     name=".ADAuthCookie" 
     path="/" 
     requireSSL="false" 
     slidingExpiration="true" 
     defaultUrl="Edit.aspx" 
     cookieless="UseCookies" 
     enableCrossAppRedirects="false"/>
</authentication>
<authorization>
    <allow users="*"/>
</authorization>
<membership defaultProvider="MyADMembershipProvider">
    <providers>
        <add name="MyADMembershipProvider" 
         type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
         connectionStringName="ADAuthConnection" 
         applicationName="/" 
         connectionProtection="Secure" 
         enableSearchMethods="true" 
         connectionUsername="company\usr" 
         connectionPassword="pwd"/>
    </providers>
</membership>

不应该只需要这些吗?我不打算使用配置文件,所以我没有配置 ProfileProvider,这会导致问题吗?

感谢您的帮助!

【问题讨论】:

  • 你的连接字符串“ADAuthConnection”是什么样的??
  • 目前是“LDAP://company.local/ou=Personel, ou=PersonelUsers,ou=OfficeX, dc=company, dc=local”,使用这种格式我的测试用例可以正常工作.

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


【解决方案1】:

你检查了吗

How To: Use Membership in ASP.NET 2.0

它很好地介绍了如何设置和使用 AD 成员资格提供程序?但是看了那篇文章,似乎你做的一切都是对的......

除了我不知道你的 AD 连接字符串是什么样子的 - 你能告诉我们那条信息吗??

【讨论】:

  • 这是我当前的格式 LDAP://company.local/ou=Personel, ou=PersonelUsers,ou=OfficeX, dc=company, dc=local 我尝试了不同的样式。许多指南都在谈论使用 cn=Users 或类似的东西,但这会给我带来错误,我追查到“你不能在连接字符串中使用组”,所以我让我的测试使用 ou=xyz 定义
猜你喜欢
  • 2018-11-07
  • 1970-01-01
  • 1970-01-01
  • 2017-01-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多