public override void OnActionExecuting(ActionExecutingContext filterContext) { var values = filterContext.RouteData.Values; var url = string.Format("/{0}/{1}", values["controller"] as string, values["action"] as string); if (urlList.Any(s => string.Equals(s, url, StringComparison.CurrentCultureIgnoreCase))) { var headers = filterContext.HttpContext.Request.Headers; ActionLog model = new ActionLog(); model.Path = HttpUtility.UrlDecode(filterContext.HttpContext.Request.Url.AbsolutePath, Encoding.UTF8); model.ClientIP = HttpUtil.RequestHostAddress; model.UserName = CookieUtil.GetCookie(GlobalVar.CookieName, GlobalVar.UserName); model.Method = filterContext.HttpContext.Request.HttpMethod; model.Para = HttpUtil.GetInputPara(); model.Level = CookieUtil.GetCookie <int>(GlobalVar.CookieName, GlobalVar.Level); model.StartTime = DateTime.Now; model.Id = LogService.AddActionLog(model); headers.Set(name, string.Format("{0},{1}", model.Id.ToString(), model.StartTime.ToString("yyyy-MM-dd HH:mm:ss"))); } }