KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been using TempData to preserve my model in between page requests, as otherwise I lose access to specific properties of classes in the model that I need. (It's a slight digression and simplification, but basically I have a List of objects which have a .name and a .active property. I have a CheckBoxFor the .active property, and that is preserved, but the .name property is set to null when the form is submitted; I need access to that property as well, so I've been storing the old model in TempData and then copying over that property when I need it. Is there a better way of doing that? I was quite surprised that properties of objects that I'm using would be nulled.) The model is stored in TempData when the user checks a checkbox, thus submitting the form. It is read out of TempData at some later time, when the user clicks a button. (There are no intervening requests.) Is using TempData in such a way safe for multiple users? In other words, does each client get its own copy of TempData? I'm worried about a situation roughly like the following: User 1 clicks checkbox, saving his model to TempData User 2 clicks checkbox, saving her model to TempData User 1 clicks button, submitting the form and reading a model from TempData What I am unsure about is which model User 1 will get. Could someone please enilghten me?
Tags (comma-separated)
Save Edits
Cancel