Search code examples
c#asp.netform-post

.Net Form POST


I've got a client that, during testing, is giving me conflicting information. I don't think they are lying but more confused. So, I would like to setup some simple auditing in my ASP.Net application. Specifically, right when any page is called, I want to immediately insert the Querystring and/or form POST data into a log table. Just the raw values.

Querystring is easy. But there doesn't seem to be a way to get the raw form POST'ed data without using BinaryRead, and if I do that, then I screw myself out of using the Request.Form collection later on.

Does anyone know a way around this?

EDIT: tvanfosson suggested Request.Params. I was looking for something that was easier to use (like Request.Querystring, only for POST), but I guess I could just as easily loop through all params and build a string of name=value&, etc).


Solution

  • All of the form data should be in Request.Params. You'd need to do this on every page, though or maybe use an HttpModule.

    [EDIT] If you want to get the form parameters separately use Request.Form, along with Request.QueryString