views:

53

answers:

0

I have an ASP.NET MVC 2 web application. There are two tables like "FIRST_KIND_OF_USERS" and "SECOND_KIND_OF_USERS". Both are mapped to the default aspnet_users table via UserId column. Each of them has it's own integer primary key column like "FirstKindOfUsersId".

When a user is trying to add some data to the database, for instance, "Create a new Task" I would like to add a new row in Tasks table with "FirstKindOfUsersId" value.

Where should I store or get this value?

At the moment I have these possible solutions:

  1. Get "FirstKindOfUsersId" value by User.Identity.Name each time;
  2. Use SESSION[] for storing these values (Where and when should I save these ones?)
  3. Use FormsAuthenticationTicket and create own custom IIdentity class. (http://stackoverflow.com/questions/1064271/asp-net-mvc-set-custom-iidentity-or-iprincipal)

Which approach is better? And if I pick the 3rd one, how to save the necessary data property and at which stage?