Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
什么时候会ViewBag刷新或清除的值?
ViewBag
当您在后续请求中离开视图时。ViewBag在控制器中创建,它将一直存在到视图的呈现。除此之外,我不建议您使用它并将其替换为视图模型。