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