Exemplo n.º 1
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            log = new CtrlActStat()
            {
                Action       = (String)filterContext.RouteData.Values["Action"],
                Controller   = (String)filterContext.RouteData.Values["Controller"],
                ActionParams = filterContext.ActionParameters == null ? String.Empty : filterContext.ActionParameters.ToString(),

                StartExecution = DateTime.Now,
                HttpMtthod     = filterContext.HttpContext.Request.HttpMethod,
                Cookies        = filterContext.HttpContext.Request.Cookies == null ? String.Empty : filterContext.HttpContext.Request.Cookies.ToString(),
                Hearders       = filterContext.HttpContext.Request.Headers.ToString(),
                OriginalUrl    = filterContext.HttpContext.Request.Url.ToString(),
                Referer        = filterContext.HttpContext.Request.UrlReferrer == null ? String.Empty : filterContext.HttpContext.Request.UrlReferrer.ToString(),
                Form           = filterContext.HttpContext.Request.Form == null ? String.Empty : filterContext.HttpContext.Request.Form.ToString(),
                Query          = filterContext.HttpContext.Request.QueryString == null ? String.Empty : filterContext.HttpContext.Request.QueryString.ToString(),
                UserAgent      = filterContext.HttpContext.Request.UserAgent,
                UserHost       = filterContext.HttpContext.Request.UserHostAddress,
            };
            if (filterContext.HttpContext.User.Identity.IsAuthenticated)
            {
                log.UserName = filterContext.HttpContext.User.Identity.Name;
            }
            base.OnActionExecuting(filterContext);
        }
Exemplo n.º 2
0
 public void AddLog(CtrlActStat log)
 {
     lock (logs)
     {
         logs.Add(log);
         if (logs.Count >= _logsMaxCount)
         {
             SaveLogs();
         }
     }
 }