protected void Page_Load(object sender, EventArgs e) { using (var t = new Log4WebStandard.Tracker("Page_Load")) { LoadBaseData(); if (this.Request.HttpMethod.EqualWithTrim("post")) { this.TryLogin(); } } }
/// <summary> /// API 入口方法 /// </summary> /// <param name="context"></param> public virtual void ProcessRequest(HttpContext context) { this.LoadFunctionId(); this._ctx = context; AjaxResult rst = new AjaxResult(); string action = context.Request["action"]; if (action.IsNotNullOrEmpty()) { this.JsonProcessor.Push("ShowAllLock", this.GetAllLock) .Push("Unlock", this.Unlock) .Push("Lock", this.Lock); using (var t2 = new Log4WebStandard.Tracker(action)) { this.AddProcess(); //this.Authorize(action); if (this.JsonProcessor.ContainsKey(action)) { var json = this.JsonProcessor[action](); this.ReturnJson(json); } else if (this.ImageProcessor.ContainsKey(action)) { var image = this.ImageProcessor[action](); this.ReturnImage(image); } else if (this.FileDownloadProcessor.ContainsKey(action)) { var file = this.FileDownloadProcessor[action](); this.DownloadFile(file.Item1, file.Item2); } else { rst = new AjaxResult { IsSuccess = false, Message = "Please send correct action" }; this.ReturnJson(JsonConvert.SerializeObject(rst)); } } } }
/// <summary> /// 页面载入处理方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void Page_Load(object sender, EventArgs e) { using (var t1 = new Log4WebStandard.Tracker("Page_Load")) { this.Action = this.Request["action"]; this.LoadBaseData(); this.AddProcess(); if (this.Request.HttpMethod.EqualWithTrim("GET") && this.Action.IsNotNullOrEmpty()) { try { this.Authorize(this.Action); using (var t2 = new Log4WebStandard.Tracker(this.Action)) { if (this.Processor.Keys.Contains(this.Action)) { this.Processor[this.Action](); } else if (this.FileDownloadProcessor.Keys.Contains(this.Action)) { var file = this.FileDownloadProcessor[this.Action](); this.DownloadFile(file.Item1, file.Item2); } else { //当处理器中没有相应Action的处理方法时提示参数错误 throw new System.Web.HttpException(400, "参数错误"); } } } catch (Exception ex) { Log4WebStandard.LogManager.GetLogger(this.GetType()).Error(ex, ex.Message); this.FlashMessage = HttpUtility.JavaScriptStringEncode(ex.Message); } } } }
protected void Page_Load(object sender, EventArgs e) { StartTime = DateTime.Now; using (var t = new Log4WebStandard.Tracker("Page_Load")) { // 验证权限 if (!SccService.Authorized()) { throw new System.Web.HttpException(401, "Auth Failed"); } LoadBaseData(); SetLangAttribute(); GetMenu(); lblLoginerName.Text = SccService.CurrentUserInfo.UserInfo.displayname; if (!String.IsNullOrEmpty(this.CompanyCode)) { var company = SccService.GetCompany(this.CompanyCode); if (company != null) { lblComapnyName.Text = this.LangType.EqualWithTrim("CN") ? company.Company_Name_CN.SafeTrim() : company.Company_Name_EN.SafeTrim(); } else { lblComapnyName.Text = this.CompanyCode; } CompanyGroup.Visible = true; } } TimeSpan BlackRunTime = DateTime.Now.Subtract(StartTime); }