Click here to Skip to main content
15,667,847 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am new for Active Directory authentication. Need to create login using active directory. Please help me with explained example or link where i can learn to create active directory login

<authentication mode="Forms">
      <forms name=".ADAuthCookie" loginUrl="~/Account/LogOn" timeout="15" slidingExpiration="false" protection="All" />
    <membership defaultprovider="MY_ADMembershipProvider">
        <clear />
        <add name="MY_ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider" connectionstringname="ADService" attributemapusername="sAMAccountName" />

What I have tried:
Updated 16-Apr-19 20:47pm

1 solution

You'll want to switch from forms to windows authentication and deny anonymous users.

    <authentication mode="Windows"/>
        <deny users="?"/>

This should open a login window when users access the system.

There's a comprehensive list with examples on the patterns and practices site at:
How To: Use Windows Authentication in ASP.NET 2.0[^]
Share this answer
itsathere 10-May-16 6:30am    
It's windows authentication not active directory authentication.
Nathan Minier 10-May-16 6:57am    
Windows authentication uses Active Directory just like native logins.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900