How to Get the HTTP Post data in C#?

asp.net, c#, http-post

Solution

This code will list out all the form variables that are being sent in a POST. This way you can see if you have the proper names of the post values.

string[] keys = Request.Form.AllKeys;
for (int i= 0; i < keys.Length; i++) 
{
   Response.Write(keys[i] + ": " + Request.Form[keys[i]] + "<br>");
}

Problem

I am using Mailgun API. There is a section that I need to provide a URL to them, then they are going to HTTP Post some data to me. I provide this URL (http://test.com/MailGun/Webhook.aspx) to Mailgun, so they can Post data. I have a list of parameter names that they are sending like (recipient,domain, ip,...). I am not sure how get that posted data in my page. In Webhook.aspx page I tried some code as follows but all of them are empty. ``` lblrecipient.text= Request.Form["recipient"]; lblip.Text= Request.Params["ip"]; lbldomain.Text = Request.QueryString["domain"]; ``` Not sure what to try to get the posted data?

Original source