通过在MVC中使用2 sms方式将短信发送到mobilenumber [英] Send sms to mobilenumber by using way 2 sms in MVC
问题描述
嗨朋友请帮帮我解决这个问题
i我正在创建一个简单的注册表单,这将从我的任何手机号码确认,我的问题是我获得成功消息,但我的手机没有收到任何消息
hi friends Please help me for this problem
i am creating a simple register form which is gonna confirm from my any mobile number,My problem is i am getting successsfull message but am not getting any received message in my Mobile
<pre lang="C#">
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Register(RegisterModel model)
{
if (ModelState.IsValid)
{
// Attempt to register the user
try
{
var smsVerificationCode =
GenerateSimpleSmsVerificationCode();
WebSecurity.CreateUserAndAccount(
model.UserName,
model.Password,
new
{
model.Mobile,
IsSmsVerified = false,
SmsVerificationCode = smsVerificationCode
},
false);
send(&amp;quot;8940495568&amp;quot;, &amp;quot;E3254R&amp;quot;, string.Format(
&amp;quot;Hi MR.&amp;quot; + model.UserName +
&amp;quot;registration verification code is: {0}&amp;quot;,
smsVerificationCode)
, model.Mobile);
Session[&amp;quot;registrationModel&amp;quot;] = model;
ViewBag.UerName = model.UserName;
return RedirectToAction(&amp;quot;SmsVerification&amp;quot;, &amp;quot;Account&amp;quot;, ViewBag.userName);
}
catch (MembershipCreateUserException e)
{
ModelState.AddModelError(&amp;quot;&amp;quot;, ErrorCodeToString(e.StatusCode));
}
}
// If we got this far, something failed, redisplay form
return View(model);
}
public void send(string uid, string password, string message, string no)
{
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://moneycentral.msn.com/investor/StockRating/srstopstocksresults.aspx?sco=1&page=1col=13" + uid + "&pwd=" + password + "&msg=" + message + "&phone=" + no + "&provider=way2sms");
HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
string responseString = respStreamReader.ReadToEnd();
respStreamReader.Close();
myResp.Close();
}</pre>
我的尝试:
请帮帮我,
实际上我正试图通过方式2短信向我的手机号码发送消息
已经我有way2短信连接的登录..我也输了用户名密码和网址但当我试图发送时间我收到成功消息但是没有从我的手机收到任何收到的消息请帮帮我
What I have tried:
please help me ,
actually am trying to send message to my mobile number by using way of way 2 sms
already i have the login for way2 sms connection..i put the user name password and url also but when i trying to send that time i am getting success message but am not get any received message from my mobile please help me
推荐答案
这些API的问题有时是他们需要国家代码前缀
到电话号码。因此,如果您要向印度号码发送短信,请尝试在号码前加上91
。只有91XXXXXXXXXX
没有'+'。
还有另一个不错的API ViaNett,如果你正在做任何学习的演示,你可以尝试一下目的。
关注此处。
C#应用程序 - 发送短信 - ViaNett [ ^ ]
谢谢
The issue with these API sometimes is that they need the country codeprefixed
to the phone number. So if you are sending SMS to an Indian number then try with prefixing '91
' to the number. Only91XXXXXXXXXX
would do no '+'.
There is another nice API ViaNett, you can give a try if you are doing any demo for learning purpose.
Follow here.
C# Application - Send sms message - ViaNett[^]
Thanks
这篇关于通过在MVC中使用2 sms方式将短信发送到mobilenumber的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!