The authentication ticket contains no field information whatsoever. It only contains a encrypted key that identifies the user.
Depending on which properties you need at runtime, you can do one of the following:
1. Use the Membership API to get user-related information. You can use the GetUser method to retrieve an object representing the current user:
MembershipUser currentUser = Membership.GetUser();
Then, you can access the properties of currentUser.
2. If you use the ASP.NET Profile system, you can store any additional information you want about the user (personal info, contact info, etc), then use the Profile object to retrieve that information.
Profiles offer a much more reliable alternative to Session state for storing user information. Unlike Session state, profile properties are strongly typed, meaning that their types are known at design time. This lets us access them without casting, do compile-time checking on them, use Intellisense with them, and so on.
3. Finally, you can store personal user information in your own custom tables, and write your own API for accessing the data. That's a lot of work that probably isn't necessary unless you have some special need, like needing to run a lot of custom queries against the data.
Last edited by Lee Dumond; April 29th, 2009 at 04:53 PM..
|