Hello All,
Recently i have faced one interview question that Which is more secure from ViewData, ViewBag, and TeampData ?
Can someone help me to answer this question ?
Thanks in advance.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Puneet KankarPosted Aug 21, 2017, 8:36 AM
TempData persists only until the next page access; ViewBag is used to pass values from the controller to the view. Neither are suitable for storing information which will last for the session. On security, they are both server side and the user will not be aware of them, so, yes, they are secure.
If you want to persists values for the duration of a session they you need a different mechanism. Several are available to you. My favourite is the use of session variables but some developers are firmly against session variables. You need to research your options further.
Rupesh KahanePosted Aug 21, 2017, 5:49 AM
Ramesh PalanivelPosted Aug 21, 2017, 5:36 AM