public Controller() { this.Context = System.Runtime.Remoting.Messaging.CallContext.HostContext as System.Web.HttpContext; if (Context == null) { throw new ArgumentException("无法获取web请求上下文信息"); } this.ViewData = new HttpContextItemWrapper(this.Context); }
protected override void OnInit(EventArgs e) { this.ViewData = new HttpContextItemWrapper(this.Context); }