【发布时间】:2020-09-27 16:03:55
【问题描述】:
我需要根据 _viewstart.chtml 中的用户更改布局。我已经在问题Why can't _ViewStart.cshtml access the ViewBag object? 中看到了答案,并且答案建议使用 ViewContext.ViewBag 但在 mvc 5 中我有错误
An object reference is required for the nonstatic field, method, or property
那么我如何在 _viewstart.chtml 中使用 viewbag 或 ViewContext。
【问题讨论】:
标签: asp.net-mvc razor asp.net-mvc-5