【发布时间】: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