hi ! 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.
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
any ideas ?
thanks in advance!
hi ! 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.
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
any ideas ?
thanks in advance!
The best way to do this is via some browser plugin like Fiddler or LiveHttpHeaders (Firefox only). Then you can intercept the raw POST data.
You can use BinaryRead to read from request body:
Request.BinaryRead
Or you could get a reference to input Stream object with:
Request.InputStream
Then you could use CopyStream:
using (FileStream fs = new FileStream(...))
    CopyStream(fs, Request.InputStream);
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.
    }
}
The HTTP Debugger Pro can show you POST data as well as can help you to simulate POST requests to check your code: http://www.httpdebugger.com
Thanks, KP