Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HttpListenerRequest where are the POST parameter?

I have search in MSDN and I can't figure where are the POST parameters from HttpListenerRequest?

Any idea?

*QueryString seem to have only Get parameter not post

like image 420
Patrick Desjardins Avatar asked Oct 22 '08 23:10

Patrick Desjardins


1 Answers

After few hours of search (I was searching before posting here) I realized that I need to send back a request to get the form parameter. So once I have the HttpListenerRequest fill up the POST parameters aren't inside. You need to send an other request to get them:

//POST param
if (webRequest.Method == "POST")
{
    StreamReader getPostParam = new StreamReader(request.InputStream, true);
    postData = getPostParam.ReadToEnd();
    byte[] postBuffer = System.Text.Encoding.Default.GetBytes(postData);
    postDataStream.Write(postBuffer, 0, postBuffer.Length);
    postDataStream.Close();
}
//END POST param
like image 77
Patrick Desjardins Avatar answered Nov 04 '22 17:11

Patrick Desjardins