Question

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

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top