“The response back will be posted directly to the application URL. Once posted, the application will need to take the status code and message ID from that information to determine the result of the SMS delivery.”
Basically I send an http request to an API to send a text message and that website further sends delivery status to another URL I have given them . Now I want to receive the data sent to my application using http how can I do it in asp.net
Edited Part
NameValueCollection pColl = Request.Params;
// Iterate through the collection and add
// each key to the string variable.
for (int i = 0; i <= pColl.Count - 1; i++)
{
paramInfo += "Key: " + pColl.GetKey(i) + "<br />";
// Create a string array that contains
// the values associated with each key.
string[]pValues = pColl.GetValues(i);
// Iterate through the array and add
// each value to the string variable.
for (int j = 0; j <= pValues.Length - 1; j++)
{
paramInfo += "Value:" + pValues[j] + "<br /><br />";
}
}
Log(add, paramInfo);
Above code generates following response for me :
Key: result<br />Value:-5<br /><br />Key: transactionid<br />Value:2a8b0559d2a6d96ff2250c5339356293<br /><br />Key: notification<br />Value:msgresult<br /><br />Key: messageid<br />Value:My test message.<br /><br />Key: botkey<br />Value:123456<br /><br />Key: ALL_HTTP<br />Value:HTTP_CONNECTION:keep-alive
HTTP_CONTENT_LENGTH:120
HTTP_CONTENT_TYPE:application/x-www-form-urlencoded
HTTP_ACCEPT:text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
HTTP_HOST:abcdef
HTTP_USER_AGENT:Java/1.6.0_21
HTTP_TRANSACTIONID:2a8b0559d2a6d96ff2250c5339356293
HTTP_MESSAGEID:95a8e9c37b9e449fe47e7d3acdd6f6e5
br /><br />Key: ALL_RAW<br />
And what I need from whole response if the value of Key : result which is -5
What your service provider is saying is that, they will call your page sending data(most probably POST) to your page.
Asp.net pages are by default called over http.
You can receive the parameters as follows:
I am sure your service provider must have supplied the parameter names they will be posting.
Edit:
Your edit makes it a lot easier.
The
resultthat you require is already part ofRequest.Params.you can get it using
Or even simpler
Note: Using
Request.Paramsis expensive on the first call as it builds theNameValueCollectionby adding parameters from the QueryString, Form, Cookie and ServerVariables.