How do you feel about the SQL table membership provider user?
1 answer
In SQL Server, you must use UNIQUEIDENTIFIER as the column type and map it to [dbo]. [aspnet_Users]. [UserId] . This assumes you are using the standard SqlMembership in an ASP.Net application. To get the logged in UserId in C # you should use:
MembershipUser mu = Membership.GetUser(); // This gets the CURRENTLY logged in user.
MembershipUser mu = Membership.GetUser("username"); // This gets the user with username username.
// Obviously you'd use only one of the above 2 lines, otherwise you'd get an error about mu being declared twice.
Guid currentUserId = (Guid)mu.ProviderUserKey;
+4
a source to share