Hey Guys,
i've some strange problem in sending sms to mobile from asp.net
i am using this function and it works great on my PC (Local)
but after i publish the application online it doesn't work.
it doesn't even give me a message to search for it
Notice: i've put try and catch and i am displaying the error message in a label but the error message returns empty.
may be this is a problem with the server but i don't know from where to start solving it
please give me any notifications about this.
this is the code:
private string SendSMS(string To_Sender, string Message_Text)
{
string resultMSG = string.Empty;
try
{
string UserName = "myUserName";
string Password = "myPassword";
string SmsText = Message_Text;
string MSISDNs = To_Sender;
string URL = "mySMS_Provider_URL";
SmsText = getBigEndianUnicodeText(SmsText);
string url = string.Format("{0}?username={1}&password={2}&smstext={3}&isCompressed=1", URL, UserName, Password, SmsText);
HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest;
request.Method = "POST";
request.Headers = new WebHeaderCollection();
request.Proxy = new WebProxy(URL, true); ;
request.Headers.Add("SOAPAction", "\"\"");
request.Method = "POST";
request.ContentType = "text/xml;charset=UTF-8";
request.CachePolicy = new
System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
request.KeepAlive = true;
byte[] buffer = Compress(MSISDNs);
Stream dataStream = request.GetRequestStream();
dataStream.Write(buffer, 0, buffer.Length);
dataStream.Close();
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
StreamReader reader = new StreamReader(response.GetResponseStream());
string resultString = reader.ReadToEnd();
}
catch (Exception ex)
{
resultMSG = ex.Message + " //// " + ex.InnerException;
}
return resultMSG;
}