Possible to have multiple Profiles in ASP.NET for different users?

Posted by asple on Stack Overflow See other posts from Stack Overflow or by asple
Published on 2009-09-14T19:14:22Z Indexed on 2010/03/17 1:01 UTC
Read the original article Hit count: 364

Filed under:
|

My application has a few different user types with their own members. For example, I have the student user as well as the teacher user. I authenticate my users through active directory in my custom MembershipProvider's ValidateUser method. While querying AD, I pull out all their relevant information. I'd like to put that information into a Profile, but from what I've read and the examples I've sen, you can only define a single Profile (like so):

<profile defaultProvider="CustomProfileProvider" enabled="true">
  <properties>
      <add name="YearLevel" type="String" />
      <add name="Name" type="String" />
      <add name="Age" type="String" />
  </properties>
</profile>

The above profile would work for a student, but not for a teacher, who does not have a value for "YearLevel" in AD. Is it possible to have multiple profiles to accomplish this? Or is it easier to add all properties from AD spanning all user types, then in my code, just check what user type they are and then access their specific properties?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-profiles