Important Namespaces Used
--------------------------
using System.Net;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Specialized;
---------------------------
(Send Otp) Button Click Event Coding
--------------------------------------
Panel1.Visible = false;
Panel2.Visible = true;
Random random = new Random();
int value = random.Next(1001, 9999);
string destinationaddr = "91" + TextBox1.Text;
string message = "Your OTP Number is " + value + " ( Sent By : Coding Logic and Syntax )";
//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" , "FammnpFW0Ks-gRKkiQvnke2nG940NkDbbl4jUV4elK"},
{"numbers" , destinationaddr},
{"message" , message1},
{"sender" , "TXTLCL"}
});
string result = System.Text.Encoding.UTF8.GetString(response);
Session["otp"] = value;
}
--------------------------------------
( Verify ) Button Click Event Coding
--------------------------------------
if(TextBox2.Text==Session["otp"].ToString())
{
Panel2.Visible = false;
Label3.Text = "Your Mobile Number Has Been Verified Successfully - Thanks";
}
else
{
Label3.Text = "OTP Number is Not Correct : Your Mobile Number not Verified";
Panel2.Visible = true;
}
----------------------------------------
--------------------------
using System.Net;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Specialized;
---------------------------
(Send Otp) Button Click Event Coding
--------------------------------------
Panel1.Visible = false;
Panel2.Visible = true;
Random random = new Random();
int value = random.Next(1001, 9999);
string destinationaddr = "91" + TextBox1.Text;
string message = "Your OTP Number is " + value + " ( Sent By : Coding Logic and Syntax )";
//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" , "FammnpFW0Ks-gRKkiQvnke2nG940NkDbbl4jUV4elK"},
{"numbers" , destinationaddr},
{"message" , message1},
{"sender" , "TXTLCL"}
});
string result = System.Text.Encoding.UTF8.GetString(response);
Session["otp"] = value;
}
--------------------------------------
( Verify ) Button Click Event Coding
--------------------------------------
if(TextBox2.Text==Session["otp"].ToString())
{
Panel2.Visible = false;
Label3.Text = "Your Mobile Number Has Been Verified Successfully - Thanks";
}
else
{
Label3.Text = "OTP Number is Not Correct : Your Mobile Number not Verified";
Panel2.Visible = true;
}
----------------------------------------