How can I store user data after login without asking the database to show this data?

I need to store the user ID, branded ID and name so that I don't have to query the database on every postback.

I know I have options like: ViewData, TempData or auth cookie, but is there a better solution?

Respectfully,

Giuliano Nunes

0


source to share


2 answers


ASP.NET Profile Providers looks like the thing you're looking for - especially if you're already using membership / role providers.



A more general article on Profile Properties: MSDN

+1


source


This sounds like a classic use of Session .



ASP.NET session state allows you to persist and retrieve values ​​for the user when the user moves ASP.NET pages in a web application. HTTP is a stateless protocol. This means that the web server treats every HTTP request for the page as an independent request. The server does not know the values ​​of the variables that were used during previous requests. ASP.NET session state identifies requests from the same browser for a limited time as a session and provides the ability to persist variable values ​​throughout the session. By default, ASP.NET session state is enabled for all ASP.NET applications.

+3


source







All Articles