Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Active Directory Membership Provider and SQL Profile Provider

I am currently designing a Membership/Profile scheme for a new project I am working on and I was hoping to get some input from others.

The project is a ASP.NET web application and due to the short time frame, I am trying to use any and all built in .NET framework components I can. The site will probably entertain < 5000 users. Each user will have a profile where custom settings and objects will be persisted between visits.

I am required to use an existing Active Directory for authentication. Since the AD schema cannot be extended to hold new fields, I am required to hold user settings and objects in a different data store. I have also been told ADAM is probably not a possible solution.

I was hoping to use the Active Directory Membership Provider for my authentication scheme and the SQL Profile Provider as a user profile data store. I would prefer not to build a custom profile provider, but I do not see this posing much of a problem if need be.

I was wondering if this is even a possible solution, and if so, has anyone had any luck with this approach.

Any comments would be greatly appreciated.

Thanks.

like image 838
cmcginty Avatar asked May 21 '09 20:05

cmcginty


People also ask

What is SQL Membership Provider?

SQLMembershipProvider : It is used to store user information in a SQL Server database. ActiveDirectoryMembershipProvider : It is used to store user information in an Active Directory.

What is membership provider in asp net?

The ASP.NET membership provider is a feature that enables ASP.NET developers to create Web sites that allow users to create unique user name and password combinations. With this facility, any user can establish an account with the site, and sign in for exclusive access to the site and its services.

What is Active Directory in asp net?

Active Directory is the primary user management system used by business and enterprise networks. It's basically just another kind of database, similar to MSSQL or Oracle, but with its own type of query language and protocol, which is based on LDAP. Active Directory in C# ASP .NET Web Application.


1 Answers

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 :-)

like image 50
marc_s Avatar answered Sep 22 '22 09:09

marc_s