C# ashx接收ContentType="text/xml"类型值

public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            System.IO.Stream s = context.Request.InputStream;
            int count = 0;
            byte[] buffer = new byte[1024];
            StringBuilder builder = new StringBuilder();
            while ((count = s.Read(buffer, 0, 1024)) > 0)
            {
                builder.Append(Encoding.UTF8.GetString(buffer, 0, count));
            }
            s.Flush();
            s.Close();
            s.Dispose();
            context.Response.Write(builder.ToString());
        }

  

posted @ 2017-02-10 16:50  会弹猫的吉他  阅读(562)  评论(0编辑  收藏  举报