Save user information in a session?

If you store user information that is required for each request for example. Role, email, username, etc.

in a session or normally get a database every request for this information

thanks

+3
source share
6 answers

If you do not plan to balance the load, then the state of the session is quite acceptable. Be careful if the session state is configured to use database persistence, because then you will not only end up in the database, but also incur overhead for serializing the objects.

, , -. , Memcached, , (), ( ), .

, , , , -, .

+3

cookie. - , . , , . , cookie .

0

, "Should". , . , -.

, -, -, " " ( -), ( , , , ).

0

, , - . InProc, , , .

ViewState, , , , , InProc.

, , InProc, / , , .

0

, , , .

, "OMG, !?!?" , . , , (100 100 ). , , , , , .

0

/. :

, , .

cookie , , . , , , , , .

, .

. , -, .

" ", , .

/ , .Net . , User.IsInRole() User.Identity.Name.

? , , , cookie . , .

0

Source: https://habr.com/ru/post/1714405/


All Articles