Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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


C#
<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>


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
Posted
Updated 30-Mar-16 20:49pm

1 solution

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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900