如何使用以下凭据发送短信..使用asp.net mvc 4 .. [英] how to send sms ..using asp.net mvc 4.. with following credentials
问题描述
http://www.unicel.in/SendSMS/sendmsg.php?uname=<< username>& pass =< password>&
.SMS格式目前从Portal发送= http://www.unicel.in/SendSMS/sendmsg.php?uname =< username>& pass =< password>& send = LVGICL& dest = 91XXXXXXXXXX& msg = LVGIC Private的快速报价高级版汽车保险为1221卢比,为期1年。你的报价没有。是23432432432.谢谢。
http://www.unicel.in/SendSMS/sendmsg.php?uname= <username>&pass= <password>&
.SMS Format currently send from Portal =http://www.unicel.in/SendSMS/sendmsg.php?uname= <username>&pass= <password>&send=LVGICL&dest=91XXXXXXXXXX&msg=Your Quick Quote Premium for LVGIC Private Car Insurance is Rs.1221 for 1 year. Your quote no. is 23432432432. Thank You.
推荐答案
这是你的解决方案。
Here is your solution.
public static string HTTP_GET(string Url, string Data)
{
string Out = String.Empty;
System.Net.WebRequest req = System.Net.WebRequest.Create(Url + (string.IsNullOrEmpty(Data) ? "" : "?" + Data));
try
{
System.Net.WebResponse resp = req.GetResponse();
using (System.IO.Stream stream = resp.GetResponseStream())
{
using (System.IO.StreamReader sr = new System.IO.StreamReader(stream))
{
Out = sr.ReadToEnd();
sr.Close();
}
}
}
catch (ArgumentException ex)
{
Out = string.Format("HTTP_ERROR :: The second HttpWebRequest object has raised an Argument Exception as 'Connection' Property is set to 'Close' :: {0}", ex.Message);
}
catch (WebException ex)
{
Out = string.Format("HTTP_ERROR :: WebException raised! :: {0}", ex.Message);
}
catch (Exception ex)
{
Out = string.Format("HTTP_ERROR :: Exception raised! :: {0}", ex.Message);
}
return Out;
}
}
调用如下方法。
Call the method like below.
HTTP_GET("http://www.unicel.in/SendSMS/sendmsg.php","uname= &pass= &send=LVGICL&dest=91XXXXXXXXXX&msg=Your Quick Quote Premium for LVGIC Private Car Insurance is Rs.1221 for 1 year. Your quote no. is 23432432432. Thank You.");
这篇关于如何使用以下凭据发送短信..使用asp.net mvc 4 ..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!