I am developping a website that will be hosted on azure cloud services. I am wondering about the best way to save some information of the logged user (basically some Ids, and a list/dictionary).
The app could be deployed on multiple instances. I know for sure that static variables are not a solution.
So is it safe to use Sessions, should I go with TempData (using the peek method or just making a wrapper class that will use the peek method) or something else?
Basically I would like to avoid calls to the database to retrieve same data because itself is reached through a webservice.
data stored in TempData will be cleared in the next request, it's just a temporary store (eg when you want to maintain data when doing redirect), so it's not a good place to put data that is valid for the whole session
Normally user information is stored in 2 ways after successfully log in:
TempData only stores data the time of your HTTP request. Session is not very reliable, and is memory consuming, as long you don't have a shared Session provider, like a SQLSessionProvider.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.