Exemple #1
0
        private void SendContent(HttpListenerResponse resp)
        {
            if (_content == null)
            {
                return;
            }
            var ms = new MemoryStream();
            var w  = new StreamWriter(ms, Encoding.UTF8);

            resp.ContentType = _content.ContentType + "; charset=utf-8";
            _content.WriteTo(w);
            w.Flush();
            resp.ContentLength64 = ms.Length;
            ms.Seek(0, SeekOrigin.Begin);
            using (var cs = resp.OutputStream)
            {
                ms.CopyTo(cs);
            }
        }