ashx如何获取application/json格式的东西

private void ProcessInfo(HttpContext context)
{
        string method = string.Empty;
        byte[] aa = new byte[context.Request.ContentLength];
        string ss = "";
        try
        {
            int r = context.Request.InputStream.Read(aa, 0, context.Request.ContentLength);
        }
        catch (Exception ex)
        {
            ss = ex.Message;
        }
        ss = Encoding.UTF8.GetString(aa);
        context.Response.Write(ss??"bbbb");

        return;

}

 

如果request的contentType为application/x-www-form-urlencoded 那自然好办.
posted @ 2008-09-12 18:26  new 维生素C.net()  阅读(3020)  评论(1编辑  收藏  举报