Confusion
but when I update, everything goes bad, it says loginModel is null
Answer
This is because you read the TempData key, and once it is read, the data will be lost for that particular key.
var Value = TempData["keyName"]
Question
how i like to track current login users
Answer
Thus, to save data even after reading data, you can "Live", as shown below
var Value = TempData["keyName"]; TempData.Keep(); //Data will not be lost for all Keys TempData.Keep("keyName"); //Data will not be lost for this Key
TempData also works in new tabs / Windows, for example, the Session variable.
You can also use Session Variable. Only the main problem is that Session Variable compares very strongly with TempData . Finally, you can also store data through controllers / area.
Hope this post helps you.
Imad Alazani Jun 19 '13 at 19:28 2013-06-19 19:28
source share