Get msg on mobile number using getway
- source
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
font-size: xx-large;
}
.auto-style2 {
width: 70%;
height: 189px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="auto-style1">
Send sms Ragistreted Person
</div>
<div>
<table class="auto-style2">
<tr>
<td>Your name</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Email Address</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Contact number</td>
<td>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td> </td>
<td>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Registretion" />
<br />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</td>
</tr>
</table>
</div>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
</form>
</body>
</html>
//NOTE : Using this source you can create one registretion Form.
- coding
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Net;
using System.Collections.Specialized;
public partial class _Default : System.Web.UI.Page
{
SqlConnection con;
SqlCommand com;
DataTable dt;
string str = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\alex\source\repos\send-sms-Ragistrestion\send-sms-Ragistrestion\App_Data\Database.mdf;Integrated Security=True";
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string destinationaddr = "91" + TextBox3.Text;
string message = "Hi " + TextBox1.Text + " , You Have Been Registered For The Contest. Thanks!!";
String message1 = HttpUtility.UrlEncode(message);
using (var wb = new WebClient())
{
byte[] response = wb.UploadValues("https://api.textlocal.in/send/", new NameValueCollection()
{
{"apikey" , "gcsqIQiS7U0-7879jDWsh5PJcBaKv7aQ3z5ablGWvp"},
{"numbers" , destinationaddr},
{"message" , message1},
{"sender" , "TXTLCL"}
});
string result = System.Text.Encoding.UTF8.GetString(response);
ragistretion();
Label2.Text = "You Have Successfully Registered";
}
void ragistretion()
{
SqlConnection con = new SqlConnection(str);
con.Open();
SqlCommand com = new SqlCommand("insert into data values ('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "')", con);
int a = com.ExecuteNonQuery();
if (a == 1)
{
Response.Write("<script>alert('data inserted')</script>");
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
}
else
{
Response.Write("<script>alert('data not inserted')</script>");
}
con.Close();
}
}
}
NOTE : This use getway on site textlocal.in we can need to generet api key for your program.
NOTE : This use getway on site textlocal.in we can need to generet api key for your program.
Comments
Post a Comment