public ActionResult smsotp(OTPValidater oTP)
        {
            string sessionOTP = Session["CurrentOTP"].ToString();

            if (oTP.otpstring == sessionOTP)
            {
                FormsAuthentication.SetAuthCookie(User.Identity.Name, false);
                return(RedirectToAction("Setpassword", "Account"));
            }
            oTP.msakmobilelable = "Error";
            return(View(oTP));
        }
        public ActionResult smsotp()
        {
            int otpValue = new Random().Next(100000, 999999);
            var status   = "";



            try
            {
                paresetEntities db        = new paresetEntities();
                var             mobileno  = db.Userinfoes.FirstOrDefault(u => u.username == User.Identity.Name);
                string          recipient = mobileno.phone.ToString();
                string          masked    = "(XXX) XXX-" + recipient.Substring(recipient.Length - 4);
                string          APIKey    = System.Configuration.ConfigurationManager.AppSettings["APIKey"].ToString();

                string message        = "Your OTP Number is " + otpValue + " ( Sent By : nexzip )";
                String encodedMessage = System.Web.HttpUtility.UrlEncode(message);

                using (var webClient = new System.Net.WebClient())
                {
                    byte[] response = webClient.UploadValues("https://api.textlocal.in/send/", new System.Collections.Specialized.NameValueCollection()
                    {
                        { "apikey", APIKey },
                        { "numbers", recipient },
                        { "message", encodedMessage },
                        { "sender", "TXTLCL" }
                    });

                    string result = System.Text.Encoding.UTF8.GetString(response);

                    var jsonObject = Newtonsoft.Json.Linq.JObject.Parse(result);

                    status = jsonObject["status"].ToString();

                    Session["CurrentOTP"] = otpValue;
                }


                //return Json(status, JsonRequestBehavior.AllowGet);
                OTPValidater obj = new OTPValidater();
                obj.msakmobilelable = "successfully send otp to you reg mobile number" + masked + status;
                obj.username        = User.Identity.Name.ToString();
                return(View(obj));
            }
            catch (Exception e)
            {
                OTPValidater obj = new OTPValidater();
                obj.msakmobilelable = "Error";
                obj.username        = User.Identity.Name.ToString();
                return(View(obj));
            }
        }