答案 0 :(得分:6)
经过几个小时的搜索(我在发布之前搜索)我意识到我需要发回一个请求来获取表单参数。所以,一旦我有HttpListenerRequest
填充,POST参数就不在里面了。您需要发送其他请求才能获取它们:
//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