public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            MonitorLog monLog = filterContext.Controller.ViewData[this.key] as MonitorLog;

            monLog.ExecuteEndTime = DateTime.Now;
            LoggerHelper.Monitor(monLog.GetLogInfo(MonitorLog.MonitorType.View));
            filterContext.Controller.ViewData.Remove(this.key);
        }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            MonitorLog monLog = new MonitorLog();

            monLog.ExecuteStartTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.ffff", DateTimeFormatInfo.InvariantInfo));
            monLog.ControllerName   = filterContext.RouteData.Values["controller"] as string;
            monLog.ActionName       = filterContext.RouteData.Values["action"] as string;
            filterContext.Controller.ViewData[this.key] = monLog;
        }
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            MonitorLog monLog = filterContext.Controller.ViewData[this.key] as MonitorLog;

            monLog.ExecuteEndTime   = DateTime.Now;
            monLog.FormCollections  = filterContext.HttpContext.Request.Form;        //form表单提交的数据
            monLog.QueryCollections = filterContext.HttpContext.Request.QueryString; //Url 参数
            LoggerHelper.Monitor(monLog.GetLogInfo());
        }
示例#4
0
        public override void OnActionExecuting(HttpActionContext actionContext)
        {
            var monLog = new MonitorLog();

            monLog.ExecuteStartTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.ffff", DateTimeFormatInfo.InvariantInfo));

            monLog.ControllerName = actionContext.ActionDescriptor.ControllerDescriptor.ControllerName;
            monLog.ActionName     = actionContext.ActionDescriptor.ActionName;
            actionContext.Request.Properties[this.key] = monLog;
        }
        public override void OnResultExecuting(ResultExecutingContext filterContext)
        {
            MonitorLog monLog = filterContext.Controller.ViewData[this.key] as MonitorLog;

            monLog.ExecuteStartTime = DateTime.Now;
        }