Last post Apr 27, 2015 04:18 AM by Lokesh B R
Apr 26, 2015 09:59 AM|Naveen Bommidi|LINK
Iam creating website to store some list by user. Here Im using Asp.Net Identity for User Login in to account. Here What i want is to make relation with user talble(created by asp.net identity) and the table i created to store data. so for that how to get
userID of User table as foreign key to my table?
Apr 27, 2015 04:18 AM|Lokesh B R|LINK
1. Create column in as UserId in your table and set that as Foreign Key with the Users table.
2. After successfully inserting data to the Membership table, then insert data to your users table by getting the userid.
MembershipUser mu = Membership.GetUser(txtUserName.Text);
if (mu != null)
// Insert to your table
Guid userId = new Guid(mu.ProviderUserKey.ToString());