public HttpListenerRequestHeaders(HttpListenerRequest request)
 {
     Request = request;
 }
예제 #2
0
 public HttpListenerContext(HttpListenerRequest request, HttpListenerResponse response)
 {
     Request  = request;
     Response = response;
 }
        /// <summary>
        /// Reads URL encoded content from the request.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static async Task <IDictionary <string, string> > ReadUrlEncodedContentAsync(this HttpListenerRequest request)
        {
            var content = await request.ReadContentAsStringAsync();

            var data = HttpUtility.ParseQueryString(content);

            var values = new Dictionary <string, string>();

            foreach (var valuePair in data)
            {
                var value = HttpUtility.UrlDecode(valuePair.Value);
                values[valuePair.Key] = valuePair.Value;
            }

            return(values);
        }