Where can I store user details from a database so I can pull the information on every page?
When a user logins, I want to be able to store all his profile information so I can display, for example, his email on different pages of my website, but I don't want to have to keep querying the database for every time I want to display his email. How would I go about 开发者_开发问答doing this?
Thanks!
You will have to work with either Cache (via System.Web.HttpContext.Current.Cache
), or put it in the session or cookie.
Cache is by far the best method, cookie causes extra bandwidth, and session has its own line of cons.
You can use asp.net session variables to store user profile information and display those details from the session variable on different pages.
精彩评论