From time to time in my pages I need to get information about the current user. I'm using Master Pages and in my master page I display the current username so immediately I need to call Membership.GetUser() on every page load to get the current user. Then occasionally, the content pages also need to refer to the current user. In addition I need some times need the UserID
Since I get the user in the master page I decided to make a public property in my master page that represents the current user that way I only call GetUser once per page load but I'm not sure if this is a good design.
I'd really like something like session to keep the current user info in but in-process session doesn't seem to be too reliable. How can I eliminate redundant calls to Membership.GetUser() (and thus the database)? Does each call to Memberhship.GetUser() hit the database or is there some caching strategy?
...
Go to the complete details ...