Download ActiveXperts SMS Messaging Server 4.1  (5828 KB - .exe file)
Send an SMS message using the SMS Messaging Server API - ASP .NET (C#)
SMS Messaging Server is an SMS messaging framework that enables companies to send, receive and process SMS- and e-mail messages. The framework is designed support virtually any scenario where low-and high volume SMS messaging is required. Use SMS Messaging Server in the following scenarios:
- Mobile users query a database; results are sent back via SMS or e-mail;
- Mobile users receive important information via SMS or e-mail while they are away from the office;
- Stock prices are sent automatically via SMS and/or e-mail, daily;
- Remote workers can update their worksheet from a remote location trough SMS;
- ICT administrators restart/reboot servers and/or daemons from remote by SMS;
- Setup an SMS voting system, supporting SMS and/or e-mail;
- Etc.
SMS Messaging Server can be well integrated into VBScript environments.
This document describes how the SMS Messaging Server can be integrated into VBScript projects.
Prerequisites
You must install and configre Internet Information Services (IIS) before using SMS Messaging Server with ASP .NET.
If you don't have IIS installed, use the following steps:
- From the Control Panel, click 'Add/Remove Programs'.
Select the 'Add/Remove Windows Components' icon from the left pane, then select 'Application Server' and click on 'Details'.
You can now select both 'ASP .NET' and 'Internet Information Services (IIS)'. Click 'OK' to continue installation;
- Make sure that ASP .NET is allowed on the web server:

(Click on the picture to enlarge)
Step 1: Download and install SMS Messaging Server
Download ActiveXperts SMS Messaging Server from the ActiveXperts Download Site and start the installation.
The installation guides you through the installation process.
Step 2: Create a new ASP .NET C# Project
Launch Microsoft Visual Studio (for instance 'Microsoft Visual Studio 2005') from the Start menu.
Choose 'New' from the 'File' menu and click on 'Web Site'. In the 'Web Site' dialog, select ASP .NET Web Site.
Select a name for the application (for instance: 'DemoApp') and a name for the solution (for instance: 'DemoSolution'). Also, select the directory where you want to store the project (for instance: 'C:\MyProjects):

(Click on the picture to enlarge)
Step 3: Refer to the SMS Messaging Server Library and create the objects
Now that a new project has been created, you must add a reference to the SMS Messaging Server API in the project in order to use the the SMS Messaging Server API objects.
To do so, choose 'Add Reference...' from the 'Project' menu.
In the 'Add Reference' dialog that pops up, select the 'COM' tab and select the 'ActiveXperts SMS messaging Server Type Library' as shown in the following picture:

(Click on the picture to enlarge)
Click 'OK' to close the 'Add Reference' dialog.
On top of your code, type the following line to use the SMS Messageging Server API namespace:
using AXSMSCFGLib;
In your Main function, declare and create the following objects:
XMessageDB objMessageDB = new XMessageDB();
XConstants objConstants = new XConstants();
You should not create an instance of a Message yourself;
it is returned by functions like Create, FindFirstMessage, FindNextMessage and Load.
Step 4: Send an SMS messages
The following code shows how to send an SMS message:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using AXSMSCFGLib;
public partial class _Default : System.Web.UI.Page
{
protected XMessageDB objMessageDB;
protected XConstants objConstants;
protected void Page_Load(object sender, EventArgs e)
{
objMessageDB = new XMessageDB();
objConstants = new XConstants();
objMessageDB.Open();
body.InnerHtml += "Open: ERROR #" + objMessageDB.LastError + " (" + objMessageDB.GetErrorDescription(objMessageDB.LastError) + ")";
body.InnerHtml += "<BR><BR>\n";
if (objMessageDB.LastError == 0)
{
object ob = (object)objMessageDB.Create();
IXMessage objMessage = (IXMessage)ob;
body.InnerHtml += "Create: ERROR #" + objMessageDB.LastError + " (" + objMessageDB.GetErrorDescription(objMessageDB.LastError) + ")";
body.InnerHtml += "<BR><BR>\n";
if (objMessageDB.LastError == 0)
{
body.InnerHtml += "Message Created with ID: " + objMessage.ID;
body.InnerHtml += "<BR><BR>\n";
objMessage.Direction = objConstants.MESSAGEDIRECTION_OUT;
objMessage.Recipient = "+31647134225";
objMessage.Status = objConstants.MESSAGESTATUS_PENDING;
objMessage.Type = objConstants.MESSAGETYPE_SMS;
objMessage.Body = "Message Created with ASP.NET(CS)";
objMessageDB.Save( ref ob );
body.InnerHtml += "Save: ERROR #" + objMessageDB.LastError + " (" + objMessageDB.GetErrorDescription(objMessageDB.LastError) + ")";
body.InnerHtml += "<BR><BR>\n";
}
objMessageDB.Close();
}
}
}
ActiveXperts SMS Messaging Server is a messaging framework to send and receive email and SMS messages.
Use the API to create new messages from various development platforms,
including Visual Basic .NET, Visual CSharp .NET,
ASP .NET (VB,CS),
ASP,
Visual Basic,
Visual Studio/Visual C++,
Delphi,
PHP,
HTML,
VBScript and any other ActiveX/COM compliant platform. SMS Messaging Server is an ActiveXperts Software B.V. Product.
|