如何将整个POST数据转储到ASP.NET中的文件 [英] How to dump the whole POST data to a file in ASP.NET

查看:82
本文介绍了如何将整个POST数据转储到ASP.NET中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm currently trying to port an app from asp.net to php, however I just hit a wall and need a hand with this.

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

I need to dump all the data an .aspx recieves via POST to a file, but I have no clue on how to do this

有什么想法吗?

推荐答案

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

You can use the InputStream property of the Request object. This will give you the raw data of the http request. Generally you might want to do this as a custom http handler, but I believe you can do it any time.

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

这篇关于如何将整个POST数据转储到ASP.NET中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆