Command not completed. request returned invalid content type text/html

Command not completed. request returned invalid content type text/html SearchSearch
Author Message
Muhammad Hammad
New member
Username: Mhammad383

Post Number: 1
Registered: 06-2016
Posted on Thursday, June 09, 2016 - 01:21 pm:   

Hello,

I am testing your NowSMS Gateway software with asp.net code example that you have given. I am receiving this error "command not completed. request returned invalid content type text/html"
But sms is sent successfully. Can you kindly guide me the issue.

Below is the code i am using.


UriBuilder urlBuilder = new UriBuilder();
urlBuilder.Host = "127.0.0.1";
urlBuilder.Port = 8800;

string PhoneNumber = "XXXXXXXXXX";
string message = "Just a simple text";

urlBuilder.Query = string.Format("PhoneNumber=%2B" + PhoneNumber + "&Text=" + message + "&User=admin&Password=admin");

HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(new Uri(urlBuilder.ToString(), false));

HttpWebResponse httpResponse = (HttpWebResponse)(httpReq.GetResponse());
System.IO.StreamReader respStreamReader = new System.IO.StreamReader(httpResponse.GetResponseStream());
string responseString = respStreamReader.ReadToEnd();
respStreamReader.Close();
httpResponse.Close();

Thank you
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 5670
Registered: 08-2008
Posted on Friday, June 10, 2016 - 12:33 pm:   

Hi,

Edit the 2-way command and UNcheck "Reply to sender with command output”.

You are generating a new HTTP request to send a message, so you do not need to have this setting enabled. (This setting is used when your command returns the text to reply with directly.)

--
Des
NowSMS Support
Muhammad Hammad
New member
Username: Mhammad383

Post Number: 2
Registered: 06-2016
Posted on Friday, June 10, 2016 - 02:11 pm:   

Great answer. Thank you. It worked :)