I have to post an xml as a string to a url and get the response back, response is depend on the posted xml (0 or 1) I using the code bellow and in all situation I receive 0. I guess my code is sending something wrong, consider the other side is working perfect.
public string DoHttpWebRequest()
{
string url="http://cfportal/assets/ajax/consumeXML.php";
StringBuilder sb = new StringBuilder();
using (StreamReader inputQueryReader = new StreamReader(@"C:\ApplicantAproved.xml")) //change the path to your XML local path
{
sb.Append(inputQueryReader.ReadToEnd());
}
String xml = sb.ToString();
HttpWebRequest req = WebRequest.Create(url) as HttpWebRequest;
req.KeepAlive = false;
req.ContentType = "text/xml; encoding='utf-8'";
req.Method = "POST";
...
Go to the complete details ...