通过在MVC中使用2 sms方式将短信发送到mobilenumber [英] Send sms to mobilenumber by using way 2 sms in MVC

查看:125
本文介绍了通过在MVC中使用2 sms方式将短信发送到mobilenumber的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友请帮帮我解决这个问题



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;amp;quot;8940495568&amp;amp;quot;, &amp;amp;quot;E3254R&amp;amp;quot;, string.Format(
                   &amp;amp;quot;Hi MR.&amp;amp;quot; + model.UserName +
                   &amp;amp;quot;registration verification code is: {0}&amp;amp;quot;,
                   smsVerificationCode)
                   , model.Mobile);

                 

                   Session[&amp;amp;quot;registrationModel&amp;amp;quot;] = model;

                   ViewBag.UerName = model.UserName;

                   return RedirectToAction(&amp;amp;quot;SmsVerification&amp;amp;quot;, &amp;amp;quot;Account&amp;amp;quot;, ViewBag.userName);
               }
               catch (MembershipCreateUserException e)
               {
                   ModelState.AddModelError(&amp;amp;quot;&amp;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(&quot;http://moneycentral.msn.com/investor/StockRating/srstopstocksresults.aspx?sco=1&amp;page=1col=13&quot; + uid + &quot;&amp;pwd=&quot; + password + &quot;&amp;msg=&quot; + message + &quot;&amp;phone=&quot; + no + &quot;&amp;provider=way2sms&quot;);
 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 code prefixed to the phone number. So if you are sending SMS to an Indian number then try with prefixing '91' to the number. Only 91XXXXXXXXXX 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆