Lifetime of ViewBag elements in ASP.net MVC3

為{幸葍}努か 提交于 2019-12-18 05:36:24

问题


When will the values of the ViewBag be flushed or cleared ?


回答1:


When you leave the view on subsequent request. ViewBag is created in the controller and it will live until the rendering of the view. In addition to this it is something that I would not recommend you using and replace it with view models.



来源:https://stackoverflow.com/questions/6858723/lifetime-of-viewbag-elements-in-asp-net-mvc3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!