locked
What's The Best Way To Create Multiple Profiles With Simple Membership? RRS feed

  • Question

  • User2095086431 posted

    Hi,

    I am familiar with adding security to a website using SImpleMembership as detailed here: http://www.asp.net/web-pages/tutorials/security/16-adding-security-and-membership . However, I have a scenario where I have multiple types of profiles e.g. teacher profile and student profile. Each profile has different fields. 

    So I am not sure how to get this to work with SimpleMembership. From what I can tell, you can only use one user profile table? What would be the best approach to apply to my scenario. The only thing I can think of is having all the fields for both teacher and student profiles in one UserProfile table. But that does sound optimal to me. Is it possible to have say, StudentProfile and TeacherProfile tables using SimpleMembership. How would I go about initializing that in the appstart file?

    Any suggestions would be greatly appreciated.

    Thanks

    Thanks in advance

    Thursday, May 16, 2013 10:48 PM

Answers

  • User379720387 posted

    What you could do is have the UserProfile table contain all the common information amongst users of your application, then have one or two other tables with the profile type specific information.

    UserId would be your primary key, then you could have a table Teachers PK TeacherId witth foreign key UserId and a table Students PK StudentId and a foreign key UserId.

    What is best? One or two tables?

    What is the cost of having two seperate tables? More complexity, more difficult to maintain, more coding.

    I myself do have a table where depending on the case, certain fields get filled.

    No complaints so far.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 17, 2013 5:38 AM

All replies

  • User379720387 posted

    What you could do is have the UserProfile table contain all the common information amongst users of your application, then have one or two other tables with the profile type specific information.

    UserId would be your primary key, then you could have a table Teachers PK TeacherId witth foreign key UserId and a table Students PK StudentId and a foreign key UserId.

    What is best? One or two tables?

    What is the cost of having two seperate tables? More complexity, more difficult to maintain, more coding.

    I myself do have a table where depending on the case, certain fields get filled.

    No complaints so far.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 17, 2013 5:38 AM
  • User2095086431 posted

    Thanks Wavemaster. suspected that having everything in one table was not optimal. But looks like the route I may have to follow

    Friday, May 17, 2013 11:31 PM