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);


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM