views:

388

answers:

4

Hi, I am creating an application that uses a 3rd party payment gateway. I submit my transaction details, and the documentation says that:

The following fields will be supplied to the return script using the POST method:

So, the 3rd party payment gateway POSTs to a url i specify... how can i get the values of the POST request on this page?

+1  A: 

If it sends key value pairs like in the query string format, you can use Request.Form to read it. Otherwise to get raw POST content try:

Request.BinaryRead
Mehrdad Afshari
+4  A: 

You will be able to get these values through the Request.Form collection. For example, Request.Form["transactionId"].

John Saunders
A: 

When you say "on this page" are you referring to the page that the payment gateway was setup to POST to, or are you asking how to reference that information on a different page, such as the one that your user is on?

A: 

Try this:

    NameValueCollection coll = Request.Form;
    foreach (var key in coll.AllKeys)
    {
        Response.Write(key + ": " + coll[key] + "<br/>");
    }

And insert it into Page_Load on the page the 3rd party gateway posts to. This loops through all the keys and prints out their value.

Tchami