简体   繁体   中英

authenticating against AD using C#

I have this code and am using VS 2005 - works nicely - however, if I try it using VS 2008, doesn't work. Any ideas?

webconfig:

<connectionStrings>
    <add 
        name="ADService" 
        connectionString="LDAP://kingletvm.creighton.edu/DC=blue,DC=jays,DC=creighton,DC=edu" />
</connectionStrings>
<system.web>
    <membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
        <providers>
            <add 
            name="AspNetActiveDirectoryMembershipProvider"
            type="System.Web.Security.ActiveDirectoryMembershipProvider, 
                    System.Web, Version=2.0.0.0, Culture=neutral, 
                    PublicKeyToken=b03f5f7f11d50a3a"
            connectionStringName="ADService" 
            attributeMapUsername="sAMAccountName" 
            description="Default AD connection"/>
        </providers>     
    </membership>
</system.web>

C# code:

Membership.ValidateUser(netid.Text, passwd.Text);

where netid and passwd come from text input boxes.

Are you running in 3.5 (or 3.0) in VS 2008? What happens if you change the .NET Framework version to 2.0? Are you getting any errors or is it just failing authentication?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM