views:

922

answers:

1

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

+3  A: 

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
Daok
I have no idea what you are on about here... the POST data is in "postData" (assuming the caller hasn't sent binary, which is possible). You just need to pull it apart... not sure what the "webRequest" is doing here...
Marc Gravell
You are right, the webRequest is for something else. I will edit.
Daok