阅读背景:

ASP.NET MVC 3 - 将会话数据传递给布局

来源:互联网 

I want to show some data on every page with the layout (_Layout.cshtml), so I made a parent controller class, and the database access executes in its constructor. This works well except the case when I want to reach the session data, because when I try to check if the session variable exists, an exception (NullReferenceException) is thrown:I want to show some data on every page with the




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: