Reputation:
I have a 3rd party submitting data via form post. I want to capture the contents of the post without actually doing
Request[FormElementName"].ToString()
for every element that i am expecting
Is there some method/property in the Request object which would allow me to capture the entire form post? Something similar to
Request.RawUrl.ToString()
Upvotes: 1
Views: 813
Reputation: 25775
The Request.Form
property returns a NameValueCollection containing all the posted parameters.
You could do something as simple as :
NameValueCollection nvc = Request.Form;
foreach (string key in nvc.AllKeys)
{
Debug.WriteLine("Key - " + key);
Debug.WriteLine("Value - " + nvc[key]);
Debug.WriteLine("---");
}
Edit: If you need to query QueryString values as well, use the Request.Params
property in the same manner.
Upvotes: 3