StringBuilder builder = new StringBuilder(); HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"]; //获取传统context HttpRequestBase request = context.Request; //定义传统request对象 using (var sm = request.InputStream) { int count = 0; byte[] buffer = new byte[1024]; while ((count = sm.Read(buffer, 0, 1024)) > 0) { builder.Append(Encoding.UTF8.GetString(buffer, 0, count)); } sm.Flush(); sm.Close(); }
时间: 2024-11-03 03:40:28