gpt4 book ai didi

c# - HttpListenerRequest 的 POST 参数在哪里?

转载 作者:太空狗 更新时间:2023-10-29 23:12:05 24 4
gpt4 key购买 nike

我在 MSDN 中搜索我不知道 HttpListenerRequest 的 POST 参数在哪里?

有什么想法吗?

*QueryString好像只有get参数没有post

最佳答案

经过几个小时的搜索(我在发帖之前搜索过)我意识到我需要发回一个请求来获取表单参数。因此,一旦我填写了 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

关于c# - HttpListenerRequest 的 POST 参数在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/227946/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com