Thursday, December 10, 2009

ASP.net 2.0 Active Directory Membership provider

with Active Directory Membership provider you can Access anyweb site using AD membership provider through login control here is the code to do that :
<system.web>


<authentication mode="Forms">

<forms name="ADAuthCookie" timeout="10" loginUrl="Login.aspx" defaultUrl="Default.aspx"></forms>
</authentication>

<authorization>
<deny users="?"/>

<allow users="*"/>
</authorization>

<membership defaultProvider="DomainLoginMembershipProvider">
<providers>

<add name="DomainLoginMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider,System.Web, Version=2.0.0.0,Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

connectionStringName="ADConnectionString"
attributeMapUsername="sAMAccountName"

enableSearchMethods="true"
connectionUsername="User@Domain.com"

connectionPassword="Password" />
</providers>

</membership>


Dont for get to add asp.net 2 login control.

No comments:

Post a Comment