Esempio n. 1
0
        /// <summary>
        /// 方法返回之后
        /// </summary>
        /// <param name="context"></param>
        public override void OnResultExecuted(ResultExecutedContext context)
        {
            //请求方法
            var RequestMethod = context.HttpContext.Request.Method;
            //请求参数
            var RequestQuerystring = context.HttpContext.Request.QueryString.Value.ToString();
            //请求ip
            var RequestIp = context.HttpContext.Request.Host;
            //请求路径
            var RequestPath = context.HttpContext.Request.Path;
            //返回结果
            //var Result = (context.Result as JsonResult)?.Value.ToString();
            //返回状态
            var StatusCode = context.HttpContext.Response.StatusCode;

            NLogHelper.WriteFileLog($"\r\n 【请求方法】:{RequestMethod};\r\n 【请求参数】:{RequestQuerystring};\r\n 【请求者IP】:{RequestIp};\r\n 【请求路径】:{RequestPath};\r\n 【返回状态】:{StatusCode};\r\n=====================================================================");
            base.OnResultExecuted(context);
        }