protected void Button1_Click(object sender, EventArgs e)
        {
            Common.Signup common = new Common.Signup();
            string        name1  = name.Text;

            common.name     = name1;
            common.email    = email.Text;
            common.mobile   = mobile.Text;
            common.password = password.Text;

            string NewGUID = System.Guid.NewGuid().ToString();

            common.accointid = NewGUID;

            Random random          = new Random();
            int    value           = random.Next(100001, 999999);
            string destinationaddr = "91" + common.mobile;
            string message         = "Your OTP Number is " + value + ". " + NewGUID + " ( Sent By : DRSN Team )";

            String message1 = HttpUtility.UrlEncode(message);

            using (var wb = new WebClient())
            {
                byte[] response = wb.UploadValues("https://api.textlocal.in/send/", new NameValueCollection()
                {
                    { "apikey", "your key" }, //your textlocal api key
                    { "numbers", destinationaddr },
                    { "message", message1 },
                    { "sender", "TXTLCL" }
                });
                string result = System.Text.Encoding.UTF8.GetString(response);

                Session["otp"] = value;
            }
            accountcreate ac = new accountcreate();
            Signupform    si = new Signupform();

            si.parametersinsert(common.email);


            Session["email"]     = common.email;
            Session["mobile"]    = common.mobile;
            Session["name"]      = common.name;
            Session["password"]  = common.password;
            Session["accountid"] = common.accointid;



            Response.Redirect("Authenticate.aspx");
        }
Пример #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            accountid = new SqlParameter();
            mobile    = new SqlParameter();
            email     = new SqlParameter();



            SqlConnection con = new SqlConnection(strConnString);

            com            = new SqlCommand();
            com.Connection = con;
            con.Open();
            //Session["accountid"] = TextBox2.Text;
            com.CommandType         = CommandType.StoredProcedure;
            com.CommandText         = "userauth";
            accountid.SqlDbType     = SqlDbType.VarChar;
            accountid.Size          = 50;
            accountid.ParameterName = "@accountid";
            accountid.Value         = Session["accountid"].ToString();
            accountid.Direction     = ParameterDirection.Input;

            com.Parameters.Add("@email", SqlDbType.VarChar, 50);
            com.Parameters["@email"].Direction = ParameterDirection.Output;
            com.Parameters.Add("@mobile", SqlDbType.VarChar, 50);
            com.Parameters["@mobile"].Direction = ParameterDirection.Output;
            com.Parameters.Add(accountid);

            com.ExecuteNonQuery();
            //Storing the output parameters value in 3 different variables.
            string em = Convert.ToString(com.Parameters["@email"].Value);
            string mb = Convert.ToString(com.Parameters["@mobile"].Value);

            con.Close();
            accountcreate ac = new accountcreate();

            ac.verifyemail(em);

            Random random          = new Random();
            int    value           = random.Next(1001, 9999);
            string destinationaddr = "91" + mb;
            string message         = "Your OTP Number is " + value + " ( Sent By : DRSN Team )";
            //Label3.Text = message;
            String message1 = HttpUtility.UrlEncode(message);

            using (var wb = new WebClient())
            {
                byte[] response = wb.UploadValues("https://api.textlocal.in/send/", new NameValueCollection()
                {
                    { "apikey", "q0fLh6VFYeg-pJBpgv9zMwv7C5vJTuJ4Co2TROeAYY" },
                    { "numbers", destinationaddr },
                    { "message", message1 },
                    { "sender", "TXTLCL" }
                });
                string result = System.Text.Encoding.UTF8.GetString(response);
                Session["otp"] = value;
            }


            Response.Redirect("authenticatemodal.aspx");
        }