예제 #1
0
        /// <inheriteddoc cref="Owasp.Esapi.Interfaces.IHttpUtilities.LogHttpRequest(HttpRequest, ILogger, ICollection&lt;string&gt;)" />
        public void LogHttpRequest(HttpRequest request, ILogger logger, ICollection <string> obfuscatedParams)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            StringBuilder requestData = new StringBuilder();

            // Write request data
            using (TextWriter dataWriter = new StringWriter(requestData)) {
                HttpRequestWriter writer = new HttpRequestWriter(dataWriter);
                writer.Write(request, Esapi.SecurityConfiguration.CurrentUser, obfuscatedParams, true);
            }

            // Log
            logger.Info(LogEventTypes.FUNCTIONALITY, requestData.ToString());
        }
예제 #2
0
        /// <inheriteddoc cref="Owasp.Esapi.Interfaces.IHttpUtilities.LogHttpRequest(HttpRequest, ILogger, ICollection&lt;string&gt;)" />
        public void LogHttpRequest(HttpRequest request, ILogger logger, ICollection<string> obfuscatedParams)
        {
            if (request == null) {
                throw new ArgumentNullException("request");
            }
            if (logger == null) {
                throw new ArgumentNullException("logger");
            }

            StringBuilder requestData = new StringBuilder();

            // Write request data
            using (TextWriter dataWriter = new StringWriter(requestData)) {
                HttpRequestWriter writer = new HttpRequestWriter(dataWriter);
                writer.Write(request, Esapi.SecurityConfiguration.CurrentUser, obfuscatedParams, true);
            }

            // Log 
            logger.Info(LogEventTypes.FUNCTIONALITY, requestData.ToString());
        }