5

I'm sending data to a payment gateway in asp.net c#. Along with amount and other params it also ask to send an url in order to receive the response that will send by the payment gateway in post method. So I send an .aspx page as the return url and once the payment process is done it redirect to this page but the Request.Form.Count is always 0 when page load so I can't have the posted values.

I've tried using simple php page which echo all the post variables and then it worked fine and displayed all the post data which I suppose to capture in aspx page. When I inspect the browser I can see the Request.Method as Get instead of POST for the page load event.

Can't I achieve this using aspx page by providing as the url to capture posted data from the payment gateway ?

    protected void Page_Load(object sender, EventArgs e)
    {

        lblAllFormItems.Text = "";
        lblAllFormKeys.Text = "";

        //Request.Form.Count = 0 , Not going inside loop
        foreach (string key in Request.Form)
        {
            string value = Request.Form.Get(key);

            if (value != String.Empty)
            {
                lblAllFormKeys.Text += "<br><b>" + key + "</b>";
                lblAllFormItems.Text += "<br>" + value;
            }
        }
    }
Hien Nguyen
  • 24,551
  • 7
  • 52
  • 62
Peck_conyon
  • 221
  • 2
  • 13

1 Answers1

5

This is possibly caused by Friendly Urls. Configure the payment gateway to call your page without the .aspx extension.

For others who land here see also why-is-my-asp-net-form-arriving-empty

hollystyles
  • 4,979
  • 2
  • 36
  • 38