views:

200

answers:

1

I'm having trouble getting AD authentication working on my website. I have the following test code that works fine :

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

On my website I get an error "Your login attempt was not successful. Please try again.". I really haven't been able to figure out what's the underlying error in the process that prevents the login.

Here are the sections in my 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>

Shouldn't this be all that is required? I don't plan to use profile so I haven't configured ProfileProvider, could this cause the problems?

Thanks for help!

A: 

Did you check out the

How To: Use Membership in ASP.NET 2.0

which gives a nice walk-through of how to set up and use AD membership provider? But glancing over that article, it seems you're doing everything right...

Except I don't know what your AD connection string looks like - can you show us that piece of information??

marc_s
This is my current formatLDAP://company.local/ou=Personel, ou=PersonelUsers,ou=OfficeX, dc=company, dc=localI've tried different styles. Many guides talk about using cn=Users or similar, but that would give me errors which I tracked down to "you can't use groups in the connectionstring", so I got my test working with ou=xyz definitions
Morri