HOW TO SEND SMS USING WAY2SMS API IN ASP.NET

in #programming6 years ago

HERE IN THIS .Net Tutorial WE WILL SEND SMS USING WAY2SMS API IN ASP.NET

HERE WE REQUIRED

WAY2SMS ACCOUNT

MOBILE NO

API SERVICES LINK :- https://smsapi.engineeringtgr.com/

Were You Can Get API,MobileNo and URL Send To Your Email Id.

First Registration Of Mobile No On Way2Sms Links:- Sites http://www.way2sms.com/ Were You Will Fill 

All Your Detail On Site,Password Will Be Create By You And Otp Will Be Send On Your Mobile Number

For Verification of Mobile No.

Second Step is API SERVICES LINK :- https://smsapi.engineeringtgr.com/  Go To That Link And Enter Your Mobile No

Which You Have Register On Way2sms Site And Emailid Were You Will Recevied Api key,MobileNo and URL.

Coding Begin

WebForm2.aspx :-

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication11.WebForm2" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

<style type="text/css">

.auto-style1 {

width: 158px;

}

.auto-style2 {

width: 210px;

}

</style>

</head>

<body style="width: 747px; height: 92px">

    <form id="form1" runat="server">

        <div>

         <table style="width:100%;">

<tr>

<td class="auto-style1">

<asp:Label ID="Label1" runat="server" Text="Enter Mobile No:-"></asp:Label>

</td>

<td class="auto-style2">

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

</td>

<td>&nbsp;</td>

</tr>

<tr>

<td class="auto-style1">&nbsp;</td>

<td class="auto-style2">

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit" />

</td>

<td>&nbsp;</td>

</tr>

<tr>

<td class="auto-style1">&nbsp;</td>

<td class="auto-style2">

<asp:Label ID="Label2" runat="server" ForeColor="Lime"></asp:Label>

</td>

<td>&nbsp;</td>

</tr>

</table>

        </div>

    </form>

</body>

</html>

C# Code :-

using System;

using System.Collections.Generic;

using System.IO;

using System.Linq;

using System.Net;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace WebApplication11

{

public partial class WebForm2 : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

protected void Button1_Click(object sender, EventArgs e)

{

string Mobile = "Your Mobile No";

string Password = "Your Password";

string Text = "This Is Test Sms";

string No = TextBox1.Text;

string key = "Email Api Key Recevied";

string URL = "https://smsapi.engineeringtgr.com/send/?Mobile=" + Mobile + "&Password=" + Password + "&Key=" + key + "&Message=" + Text + "&To=" + No + "";

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);

request.Method = "GET";

request.ContentType = "application/json";

request.ContentLength = 0;

try

{

HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse();

Stream webStream = webResponse.GetResponseStream();

StreamReader responseReader = new StreamReader(webStream);

string response = responseReader.ReadToEnd();

Console.Out.WriteLine(response);

responseReader.Close();

Label2.Text = "Sucessfully Done";

}

catch (Exception xe)

{

Console.Out.WriteLine(".....................");

Console.Out.WriteLine(xe.Message);

}

}

}

}

Video Related To Topic Is Below



If You Haven't Subscribers My Channel Than Please Subscribers It And Even Share It Link Of My Channnel :- https://www.youtube.com/channel/UCdIDIGUh3rL9A_Yt_tbZmkg Please Go And Subscribers It
Sort:  

Hello! Your post has been resteemed and upvoted by @ilovecoding because we love coding! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On!

Reply !stop to disable the comment. Thanks!

I thought this site gets blocked ???

Posted using Partiko Android

If You Haven't Subscribers My Channel Than Please Subscribers It And Even Share It Link Of
My Channnel :- https://www.youtube.com/channel/UCdIDIGUh3rL9A_Yt_tbZmkg Please Go And Subscribers It