Hi Valentine,
The MembershipUser class has a ProviderUserKey property that returns the unique ID of the user from the database.
Something like this:
Code:
Guid userId = (Guid)Membership.GetUser().ProviderUserKey;
should give you the unique ID of the currently logged in user.
However, Microsoft recommends to not use this key and treat it as internal. Instead, you should use a combination of the user name and the application name. If you only store data of one application in your database, you can ignore the application name part.
You retrieve the name of the user from User.Identity.Name. Chapter 17, page 642 shown an example where the user name is used to link a photo album to a user.
Cheers,
Imar