Request.InputStream 接收Post Data

今天 用 Request.Form /Request.Params 等怎么也获取不到客户发过来的Post 数据

后来试着用了 Request.InputStream 竟然可以

 

 
using (System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream))
{
string inputStream = sr.ReadToEnd();
 

}

 

或者

 

byte[] byts = new byte[Request.InputStream.Length];
Request.InputStream.Read(byts, 0, byts.Length);
string req = System.Text.Encoding.Default.GetString(byts);
req = Server.UrlDecode(req);

posted @ 2016-05-03 14:12  zslm___  阅读(2175)  评论(0编辑  收藏  举报