MVC Passing ViewBag value from another controller
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've set a value into Viewbag.message in my default HomeController and successfully display it in my Shared/_Layout.cshtml . After that I added another TestController and in the TestController view, Viewbag.message seems to be null. May I know what's wrong with it. Correct me if I'm wrong,from my understanding Viewbag.Message should be available from all over the places? 回答1: ViewBag is a dynamic property that takes advantage of the new dynamic features in C# 4.0. Basically it is a wrapper around the ViewData and also used to pass data from