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?
Can I use POST method to get data from the server and GET method to post data to the server? A POST request can have a response, but a GET request can't have a body (well technically it can, but there's surprisingly few systems that support it). Therefore this question makes no sense.
HTTP works as a request-response protocol between a client and a server in a format that both HTTP clients and servers can understand. For example, when a user uploads a document to the server, the browser sends an HTTP POST request and includes the document in the body of the POST message.
Make an HTTP POST Web Request With the HttpWebRequest Class in C# The HttpWebRequest class provides methods to interact directly with the server using HTTP protocol in C#. We can use the HttpWebRequest. Method = "POST" property to specify that an HTTP web request is a POST request in C#.
HTTP POST requests supply additional data from the client (browser) to the server in the message body. In contrast, GET requests include all required data in the URL.
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>"); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With