1

Good day, I am pulling my hair on this one.. I have Active Directory Memebership Provider configured like this:

<system.web>
<membership>
<providers>
<clear/>
<add name="dev"
 type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web,       Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
 connectionStringName="DevTestConnStr"
 attributeMapUsername="sAMAccountName"
 connectionUsername="dev\Administrator"
 connectionPassword="Password" 
 applicationName="/web"  
  />

The provider is instantiated correctly but when I call this:

var user = Membership.Providers["myDomain"].GetUser("myUser", false);

the call always returns null, except the case when I pass "Administrator" into the call... I have run out of ideas on how to make it work. Please help!

Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
dexter
  • 7,063
  • 9
  • 54
  • 71

2 Answers2

2

You may want to check this MSDN article.

From the article...

The service account that you use to connect to Active Directory must have sufficient permissions in Active Directory. If you place your user accounts in an Active Directory organizational unit (OU), you can create and use a service account that has only read, write, and delete access on that OU (and, optionally, reset password privilege).

Also, this post.

Community
  • 1
  • 1
Andrew Flanagan
  • 4,267
  • 3
  • 25
  • 37
1

Just as when I was already ready to bail, I decided to change my LDAP connection string from:

"LDAP://dev.local/CN=Users,DC=Dev,DC=local" 

to

"LDAP://dev.local/DC=Dev,DC=local". 

Now works as expected!

dexter
  • 7,063
  • 9
  • 54
  • 71