I'm working on a portalsystem to share information and documents etc. Each user can have mulitple profiles. Each profile can have different roles and permissions thereby. Now everything is working fine, but I have a question about the MembershipProvider and MembershipUser.
I'm using a custom MembershipProvider and MembershipUser in combination with OpenAccess ORM.
I rely a lot on the (CustomMembershipUser)Membership.GetUser()
. For example I build a usermenu where they can see as which user they are logged in and from which profiles they can choose.
To build this menu and collect the groups, roles and permissions for the current profile there are a lot of calls to the Membership.GetUser()
from different locations in the code. I first cached the user and returned this based on the ProviderUserKey, but I was told this is unsafe. So I removed the caching, but it was much faster. Is there an alternative, best practice for this?