| | |
| | | private string RequestDataLog(HttpContext context) |
| | | { |
| | | var request = context.Request; |
| | | if (request.ContentType?.ToLower() != "multipart/form-data" && request.ContentLength <= 100000) |
| | | { |
| | | var sr = new StreamReader(request.Body); |
| | | |
| | | object obj = new |
| | | var sr = new StreamReader(request.Body); |
| | | |
| | | object obj; |
| | | string bodyData = sr.ReadToEndAsync().Result; |
| | | if (request.ContentLength <= 100000) |
| | | { |
| | | obj = new |
| | | { |
| | | QueryString = request.QueryString.ToString(), |
| | | BodyData = sr.ReadToEndAsync().Result |
| | | BodyData = bodyData |
| | | }; |
| | | |
| | | string data = JsonConvert.SerializeObject(obj); |
| | | |
| | | request.Body.Position = 0; |
| | | |
| | | return data; |
| | | } |
| | | return ""; |
| | | else |
| | | { |
| | | obj = new |
| | | { |
| | | QueryString = request.QueryString.ToString(), |
| | | BodyData = "" |
| | | }; |
| | | } |
| | | string data = JsonConvert.SerializeObject(obj); |
| | | |
| | | request.Body.Position = 0; |
| | | |
| | | return data; ; |
| | | } |
| | | |
| | | private string ResponseDataLog(HttpResponse response) |
| | | { |
| | | if (response.ContentType?.ToLower() != "multipart/form-data" && response.ContentLength <= 100000) |
| | | if (response.ContentLength <= 100000) |
| | | { |
| | | response.Body.Position = 0; |
| | | using StreamReader stream = new StreamReader(response.Body, leaveOpen: true); |