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.
我需要从 HttpCONtext.Items 请求缓存中获取一个值,我应该在哪里执行此操作?
是否有我应该覆盖的特定事件或构造函数?
ViewMasterPage 是 Control 的子类;你应该能够在正常的页面事件周期中得到它:
namespace MvcDemo.Views.Shared { public partial class Site : System.Web.Mvc.ViewMasterPage { protected override void OnLoad(EventArgs e) { string nowWhat = Context.Items["nowWhat"] as string; base.OnLoad(e); } } }