R – How to get the current user equivalent to an aspnet_User object

asp.netasp.net-membershipauthenticationentity-frameworkforeign-keys

My table, AccLink, has a foreign key, UserId, to the aspnet_User table created by the Membership Provider.

When creating an object of type AccLink (I'm using the entity framework) I need to assign the aspnet_User by getting the current user object.

I tried Membership.GetUser(userName) but it said it couldn't be converted to type aspnet_User. What is equivalent to the model built by the entity framework that I can use to assign to the AccLink object?

Best Answer

I think the only way is to get an aspnet_User object from the database (e.g. select by user name or email or some unique info you get from MembershipUser)