var httpFormData = filterContext.HttpContext.Request.Form; var logContent = string.Empty; //獲取url的 logContent = filterContext.HttpContext.Request.QueryString.ToString(); //獲取表單的 if (httpFormData.Count > 0) { try { var formDataList = (from f in httpFormData.AllKeys select new { name = m, value = httpFormData[m] }).ToList(); logContent = string.Join(",", formDataList); } catch (Exception ef) { logContent = filterContext.HttpContext.Server.HtmlEncode(ef.ToString()); } }