how do i setup my web.config to use Forms authentication, Set The Membership provider to ActiveDirectoryMembershipProvider and use the built-in login control. so that I can log into my web application using a valid active directory username and password???
R – membership provider
membershipprovider
Related Solutions
You have a few choices. One is as was suggested, just change the template. Another (and better, although much more work) would be to pop open the control in reflector to see how it works, then extend it and override the relevant bits to remove references to password.
The third (and what I would recommend) is to just roll your own. The Membership
, Roles
, and Profile
classes are all fairly easy to work with, and the CreateUserWizard
is fairly heavy weight. Unless it is exactly what I need, I usually throw together a user control that does it anyways, even when using the default provider.
First off - I've never done this myself.
There's a really excellent series (14 !! parts) on the whole topic of ASP.NET 2.0 membership, roles and profile provider systems by Scott Mitchell at 4 Guys from Rolla.
According to my understanding, you should be able to configure this behavior you are looking for by using basically these two sections in your web.config:
<!-- configure Active Directory membership provider -->
<membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
<providers>
<add name="AspNetActiveDirectoryMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider,
System.Web, Version=2.0.3600, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
<!-- configure SQL-based profile provider -->
<profile defaultProvider="SqlProvider">
<providers>
<add name="SqlProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="SqlProfileProviderConnection"
applicationName="YourApplication" />
</providers>
<!-- specify any additional properties to store in the profile -->
<properties>
<add name="ZipCode" />
<add name="CityAndState" />
</properties>
</profile>
I would think this ought to work :-)
Best Answer
Check out this walk through for the ActiveDirectoryMembershipProvider.