This
article is about sending SMS using ASP.NET through HTTP. To send SMS messages
from ASP.NET applications, you need to install SMS Gateway on your computer. In here we use Ozeki NG - SMS Gateway for
that purpose. Ozeki NG - SMS Gateway will use a GSM phone/modem attached to your PC (with a phone-to-PC data cable) or
an IP SMS connection to send messages. Your ASP.NET application will perform an HTTP request to send
messages using the Ozeki NG program. For a better understanding of how it
works, look at the following diagram.
In the diagram you can see an Internet user, a web server with the
ASP.NET application, Ozeki NG - SMS Gateway, a mobile phone attached to the
server computer and mobile user receiving the message.
How to install Ozeki NG - SMS Gateway-:
·
The Ozeki NG - SMS Gateway software enables you
to use your computer to send and receive SMS messages to and from mobile
devices.
·
It allows SMS messaging in two ways:
Directly connecting to the SMS Center
of a GSM service provider over the Internet or
Connecting to it using a GSM modem
attached to the PC with a phone-to-PC data cable.
·
To run the Ozeki NG - SMS Gateway software, your
computer needs to meet certain hardware and software requirements.
Operating
system: Windows XP, Windows 2003 or Windows Vista
Other
software requirements: Internet Information Services (IIS) ,.NET Framework 3.5 ,Ozeki
NG-SMS gateway
Development platform: Microsoft Visual Studio
.NET
·
To obtain the software, you can simply download
it from the website dedicated to the product.
·
When you have downloaded the software, you will
need to install it.
·
After you have installed the software you can
start to configure service provider connections in Ozeki NG SMS Gateway to be
able to send SMS messages.
Use this link to see how to configure a GSM phone or GSM modem connection.
Step 1:
Design an interface for Compose Message
Open
Visual studio 2008 --> File --> New --> Project.
Then
create an ASP.Net web application.
Type
following code segment to get a simple interface for compose a message.
Composemessage.aspx
-:
The interface will look like as follow -:
Step 2: Processing data coming from the HTML
form
After filling in the fields and clicking the Send button , the ASP server receives the information about the form. In the Composemessage.aspx.cs file, the "protected void btnSend_Click (object sender, EventArgs e)" procedure is called. At the beginning of the procedure, check the data of the textbox fields. The Recipient box is mandatory. If it is empty, the processing will be aborted, and the Internet user will be shown the error. If the checking is successful, you will create the URL that will tell the Ozeki NG - SMS Gateway Server the requested information. We need the following: the URL of the computer running Ozeki NG - SMS Gateway Server the default URL is http://127.0.0.1/httpapi (127.0.0.1 means that Ozeki NG - SMS Gateway Server is installed on the same computer on which the ASP.NET script is running), the port number on which the server listens, the username, which is authorized to log in to the Ozeki NG - SMS Gateway Server and to send messages (the default username is admin), the user's password (the default is abc123), the message type (the default is SMS:TEXT), the recipient and the message data. The following values must be URL-encoded: username, password, recipient and message data.
In Composemessage.aspx.cs should be including
following codes for “Send” button click event.
Composemessage.aspx.cs-:
Nice and working article. Thank ! :)
ReplyDeleteit shows "Ozeki NG SMS Gateway Server is not running!" and it doesn't working
ReplyDelete