gpt4 book ai didi

asp.net - 如何将整个 POST 数据转储到 ASP.NET 中的文件

转载 作者:行者123 更新时间:2023-12-04 13:06:34 26 4
gpt4 key购买 nike

我目前正在尝试将应用程序从 asp.net 移植到 php,但是我只是碰壁了,需要帮助。

我需要将 .aspx 通过 POST 收到的所有数据转储到文件中,但我不知道如何执行此操作

有任何想法吗 ?

最佳答案

您可以使用 Request 对象的 InputStream 属性。这将为您提供 http 请求的原始数据。通常,您可能希望将其作为自定义 http 处理程序来执行,但我相信您可以随时执行此操作。

if (Request.RequestType == "POST")
{
using (StreamReader reader = new StreamReader(Request.InputStream))
{
// read the stream here using reader.ReadLine() and do your stuff.
}
}

关于asp.net - 如何将整个 POST 数据转储到 ASP.NET 中的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/870022/

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