I'm taking my first crack at asp.net membership security. I'm using microsoft's database model, so many of my tables will reference the aspnetUsers table via UserId foreign key. Hence, I will need the user id often in my code, which is an MVC 2 site.
I'm wondering what is the best way to get this user id since i will be needing it repeatedly to make data access calls. Currently I'm using
(Guid)Membership.GetUser().ProviderUserKey;
What i don't like about this is that it makes a database call every time i need the id. I've done a lot of research and the only way i've seen to get around it is to store the id in the FormsAuthenticationTicket, which may prevent a (small) security risk, or to store it in session, which has its own pitfalls. (I also looked at using a custom identity, but for MVC you create a postauthenticate event which is called on every request, so that really doesn' ...
Go to the complete details ...