Lifetime of ViewBag elements in ASP.net MVC3
When will开发者_JAVA技巧 the values of the ViewBag
be flushed or cleared ?
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.
精彩评论