开发者

Asp.net, Active Directory authentication not working

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"/>
    <开发者_JS百科;/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!


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜