473,884 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET: Sending SMS - BulkSMSGateway returns error 4006

87 New Member
Hi,

I use BulkSMSGateway - ATSMS.dll for sending SMS from ASP.NET.

When I click Connect button, I am able to connect to the mobile using bluetooth successfully from my WebPage.

But when i click Send button, the oGsmModem returns error
e.errorcode=400 6 in the oGsmModem_Outbo xSMSSent event.

But i can send SMS successfully using VB.NET Windows Appication.

Why it returns error in web form alone?

Please help me to send SMS from my Web Page.

Thanks in advance...
Apr 2 '10 #1
3 4071
CroCrew
564 Recognized Expert Contributor
Hello Ananthu,

A few years back I created an example in Classic ASP for a member to send SMS text to phones via a website. [See here]

I took that code and changed it up to work in the dot.net environment. I have not tested it out but I think it should work for you. This way you don’t have to use 3rd party addons.

Happy Coding,
CroCrew~


Default1.aspx
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default1.aspx.vb" Inherits="Default1" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4.     <head runat="server">
  5.         <title></title>
  6.     </head>
  7.     <body>
  8.         <form id="form1" runat="server">
  9.             <div>
  10.                 <table border="0"> 
  11.                     <tr> 
  12.                         <td>Phone Number:</td> 
  13.                         <td><asp:TextBox ID="PhoneNumber" runat="server" /><font size="1">(only enter the numbers) example 6045555555</font></td> 
  14.                     </tr> 
  15.                     <tr> 
  16.                         <td>Select Your Carrier</td> 
  17.                         <td> 
  18.                             <asp:DropDownList ID="Carrier" runat="server">
  19.                                 <asp:ListItem Value="@tmomail.net" Text="T-Mobile (USA)" />
  20.                                 <asp:ListItem Value="@message.alltel.com" Text="Alltel Wireless" />
  21.                                 <asp:ListItem Value="@mms.att.net" Text="AT&T Mobility (formerly Cingular)" />
  22.                                 <asp:ListItem Value="@cingularme.com" Text="Cingular (Postpaid)" />
  23.                                 <asp:ListItem Value="@cwemail.com" Text="Centennial Wireless" />
  24.                                 <asp:ListItem Value="@cingularme.com" Text="Cingular (GoPhone prepaid)" />
  25.                                 <asp:ListItem Value="@fido.ca" Text="Fido (Canada)" />
  26.                                 <asp:ListItem Value="@pcs.rogers.com" Text="Rogers (Canada)" />
  27.                                 <asp:ListItem Value="@messaging.sprintpcs.com" Text="Sprint (PCS)" />
  28.                                 <asp:ListItem Value="@page.nextel.com" Text="Sprint (Nextel)" />
  29.                                 <asp:ListItem Value="@vtext.com" Text="Verizon" />
  30.                                 <asp:ListItem Value="@vmobl.com" Text="Virgin Mobile (USA)" />
  31.                                 <asp:ListItem Value="@vmobile.ca" Text="Virgin Mobile (Canada)" />
  32.                                 <asp:ListItem Value="@mmst5.tracfone.com" Text="Tracfone (prepaid)" />
  33.                             </asp:DropDownList>
  34.                         </td> 
  35.                     </tr> 
  36.                     <tr> 
  37.                         <td colspan="2"> 
  38.                             <textarea id="YourMessage" runat="server" cols="142" rows="5" style="width:500px">Only 142 characters can be sent!</textarea> 
  39.                         </td> 
  40.                     </tr> 
  41.                     <tr><td colspan="2"><asp:Button ID="Send" runat="server" Text="Send Message to Phone" /></td></tr> 
  42.                 </table> 
  43.                 <p>*Standard text messaging rates apply.</p>
  44.             </div>
  45.         </form>
  46.     </body>
  47. </html>
  48.  

Default1.aspx.v b
Expand|Select|Wrap|Line Numbers
  1. Imports System.Net.Mail
  2.  
  3. Partial Class Default1
  4.     Inherits System.Web.UI.Page
  5.  
  6.     Protected Sub Send_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Send.Click
  7.         Try
  8.             Dim oMail As New MailMessage
  9.             With oMail
  10.                 .From = New MailAddress("YourMail@MyEmail.com")
  11.                 .To.Add(PhoneNumber.Text & Carrier.SelectedValue)
  12.                 .Subject = ""
  13.                 .Body = YourMessage.Value
  14.                 .IsBodyHtml = True
  15.             End With
  16.  
  17.             Dim oSMTP As New SmtpClient
  18.             With oSMTP
  19.                 .Host = "mail.yourServer.org"
  20.                 .Credentials = New System.Net.NetworkCredential("YourMail@MyEmail.com", "Password")
  21.                 .Send(oMail)
  22.             End With
  23.         Catch ex As Exception
  24.             Response.Write(ex)
  25.             Response.End()
  26.         End Try
  27.     End Sub
  28. End Class
  29.  
Here is a link to more Email to SMS Gateways: http://en.wikipedia.org/wiki/List_of...ng_SMS_transit
Apr 2 '10 #2
Ananthu
87 New Member
Hi,

This is my code for sending SMS using BulkSMSGateway - ATSMS.dll.
Expand|Select|Wrap|Line Numbers
  1. Imports ATSMS
  2. Imports ATSMS.SMS
  3.  
  4. Partial Class bulkSMS
  5.     Inherits System.Web.UI.Page
  6.  
  7.     Private Const PHONE_BOOK As String = "phonebook.txt"
  8.  
  9.     Private m_strPhoneBook As String
  10.  
  11.     Private WithEvents oGsmModem As New GSMModem
  12.  
  13.     Dim tbl As String
  14.     Dim str As String
  15.     Dim item As Array = Array.CreateInstance(GetType(String), 100)
  16.     Dim cs As clsEPAS = New clsEPAS
  17.     Dim fieldname As String
  18.     Dim fieldvalue As String
  19.  
  20.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As       System.EventArgs) Handles Me.Load
  21.         Dim f As Integer
  22.         f = cs.connect
  23.         If Not IsPostBack Then
  24.             'CheckForIllegalCrossThreadCalls = False
  25.  
  26.             tbl = "tbl_TimeDetails"
  27.             fieldname = "time_session"
  28.             item = cs.getname(tbl, fieldname)
  29.             ddlSession.Items.Add("Select")
  30.             For i As Integer = 0 To item.Length - 1
  31.                 If IsNothing(item(i)) Then
  32.                     Exit For
  33.                 Else
  34.                     ddlSession.Items.Add(item(i))
  35.                 End If
  36.             Next
  37.             For i As Integer = 1 To 50
  38.                 ddlComPort.Items.Add("COM" & i)
  39.             Next
  40.             For i As Integer = 4 To 8
  41.                 ddlDataBit.Items.Add(i)
  42.             Next
  43.         End If
  44.     End Sub
  45.  
  46.     Protected Sub btnConnect_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnConnect.Click
  47.         If ddlComPort.Text = String.Empty Then
  48.             Response.Write("COM Port must be selected")
  49.             Return
  50.         End If
  51.  
  52.         oGsmModem.Port = ddlComPort.Text
  53.  
  54.         If ddlBaudRate.Text <> String.Empty Then
  55.             oGsmModem.BaudRate = Convert.ToInt32(ddlBaudRate.Text)
  56.         End If
  57.  
  58.         If ddlDataBit.Text <> String.Empty Then
  59.             oGsmModem.DataBits = Convert.ToInt32(ddlDataBit.Text)
  60.         End If
  61.  
  62.         If ddlStopBit.Text <> String.Empty Then
  63.             Select Case ddlStopBit.Text
  64.                 Case "1"
  65.                     oGsmModem.StopBits = Common.EnumStopBits.One
  66.                 Case "1.5"
  67.                     oGsmModem.StopBits = Common.EnumStopBits.OnePointFive
  68.                 Case "2"
  69.                     oGsmModem.StopBits = Common.EnumStopBits.Two
  70.             End Select
  71.         End If
  72.  
  73.         If ddlFlowControl.Text <> String.Empty Then
  74.             Select Case ddlFlowControl.Text
  75.                 Case "None"
  76.                     oGsmModem.FlowControl = Common.EnumFlowControl.None
  77.                 Case "Hardware"
  78.                     oGsmModem.FlowControl = Common.EnumFlowControl.RTS_CTS
  79.                 Case "Xon/Xoff"
  80.                     oGsmModem.FlowControl = Common.EnumFlowControl.Xon_Xoff
  81.             End Select
  82.         End If
  83.  
  84.         Try
  85.             oGsmModem.Connect()
  86.         Catch ex As Exception
  87.             Response.Write(ex.Message)
  88.             Return
  89.         End Try
  90.  
  91.         Try
  92.             oGsmModem.NewMessageIndication = True
  93.         Catch ex As Exception
  94.  
  95.         End Try
  96.  
  97.         btnSend.Enabled = True
  98.         btnDisconnect.Enabled = True
  99.         btnConnect.Enabled = False
  100.  
  101.         oGsmModem.AutoDeleteSentMessage = True
  102.         Response.Write("Connected to phone successfully !")
  103.     End Sub
  104.  
  105.     Protected Sub btnDisconnect_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisconnect.Click
  106.         Try
  107.             oGsmModem.Disconnect()
  108.         Catch ex As Exception
  109.             Response.Write(ex.Message)
  110.         End Try
  111.  
  112.         btnSend.Enabled = False
  113.         btnDisconnect.Enabled = False
  114.         btnConnect.Enabled = True
  115.     End Sub
  116.  
  117.     Private Sub Initialize()
  118.         ' Read from the phone book
  119.         'Dim strContent As String
  120.         'm_strPhoneBook = Application.StartupPath & "\" & PHONE_BOOK
  121.         'If My.Computer.FileSystem.FileExists(m_strPhoneBook) Then
  122.         '    strContent = My.Computer.FileSystem.ReadAllText(m_strPhoneBook)
  123.         '    Dim lines() As String = strContent.Split(ControlChars.CrLf)
  124.         '    Dim i As Integer
  125.         '    For i = 0 To lines.Length - 1
  126.         '        lstMobileNumber.Items.Add(lines(i))
  127.         '    Next
  128.         'End If
  129.     End Sub
  130.  
  131.     Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.Click
  132.         If txtMessage.Text.Trim = String.Empty Then
  133.             Response.Write("Message must not be empty !")
  134.             Return
  135.         End If
  136.  
  137.         If StringUtils.IsUnicode(txtMessage.Text) Then
  138.             oGsmModem.Encoding = Common.EnumEncoding.Unicode_16Bit
  139.         Else
  140.             oGsmModem.Encoding = Common.EnumEncoding.GSM_Default_7Bit
  141.         End If
  142.  
  143.         For Each item As String In lstMobileNumber.Items.ToString
  144.             If item.Trim <> String.Empty Then
  145.                 oGsmModem.SendSMSToOutbox(item.Trim, txtMessage.Text.Trim)
  146.             End If
  147.         Next
  148.  
  149.         Response.Write("Message is queued for sending !")
  150.     End Sub
  151.  
  152.     Private Sub oGsmModem_OutboxSMSSent(ByVal e As ATSMS.OutboxSMSSentEventArgs) Handles oGsmModem.OutboxSMSSent
  153.         If e.ErrorCode > 0 Then
  154.             txtDelivaryReport.Text = txtDelivaryReport.Text & "Error sending message to " & e.DestinationNumber & ". " & e.ErrorDescription & ControlChars.CrLf
  155.         Else
  156.             txtDelivaryReport.Text = txtDelivaryReport.Text & "Message is delivered to " & e.DestinationNumber & ControlChars.CrLf
  157.         End If
  158.     End Sub
  159.  
  160. End Class
I am able to connect to phone successfully. btnSend_click code is working properly. But I get e.errorcode=400 6 in oGsmModem_Outbo xSMSSent event after btnSend_click event.

The same sms codings work successfully using windows application. But in web application only, it returns e.errorcode=400 6. I am unable to send SMS.

Please help me...

Thanks in advance.
Apr 6 '10 #3
CroCrew
564 Recognized Expert Contributor
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

Thanks,
CroCrew~
Apr 7 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

47
12431
by: Mountain Bikn' Guy | last post by:
Take some standard code such as shown below. It simply loops to add up a series of terms and it produces the correct result. // sum numbers with a loop public int DoSumLooping(int iterations) { int result = 0; for(int i = 1;i <=iterations;i++) { result += i;
5
3855
by: aladdinm1 | last post by:
Hi All, I have an annoying trouble with binary serialization. I have a windows forms application which works like a server and keeps sending data to its clients. The data is serialized before being sent using BinaryFormatter and a serializable object. When using a windows forms application as a client, everything works just fine and deserialized data can be received intact. When the client application is is embedded in Internet Explorer (I...
3
3714
by: Robert A. van Ginkel | last post by:
In news:OZ0W9RsdDHA.2432@TK2MSFTNGP10.phx.gbl... I ask the question how I can see if all the data is on the other side of the connection. I got as answer that I should use the blocking property. I tried this I don't see any diffents, I am sending 10Mb and the Send/BeginSend command doesn't wait till the data is on the remotepoint. Can somebody pls. explain this. Regards Robert.
7
17366
by: Mark Waser | last post by:
Hi all, I'm trying to post multipart/form-data to a web page but seem to have run into a wall. I'm familiar with RFC 1867 and have done this before (with AOLServer and Tcl) but just can't seem to get it to work in Visual Basic. I tried coding it once myself from scratch and then modified a class that I found on a newsgroup (referenced below). Both seem to be doing the same thing and neither works (or rather, they seem to work but the...
6
17215
by: ransoma22 | last post by:
I developing an application that receive SMS from a connected GSM handphone, e.g Siemens M55, Nokia 6230,etc through the data cable. The application(VB.NET) will receive the SMS automatically, process and output to the screen in my application when a message arrived. But the problem is how do I read the SMS message immediately when it arrived without my handphone BeEPINg for new message ? I read up the AT commands, but when getting down...
4
12314
by: Lucvdv | last post by:
I have to connect to a server set up by the government, where they used Apache Axis to create a webservice. The code I use to interface to the webservice is generated by wsdl.exe, based on a .wsdl file they sent me. Now a problem turns up with a date field they implemented as xsd:dateTime, even though it only contains a date.
9
8346
by: craig.overton | last post by:
All, I am currently developing an FTP class in VB.NET. It's kid tested, mother approved when trying to access an FTP Server on a Windows box meaning I can connect, run commands, upload and download a file no problem. My issues come when I try to use the same class with the same commands to access an FTP server on a UNIX box. I can connect and login just fine, but after that all my commands come back "500 'PWD': command not understood."....
4
6073
by: shamirza | last post by:
4 9 6 18.ATLAS-AJAX Note: - As an IT professional it's useful to know what the difference is between Hype and usefulness. For instance if there is a new technology coming in many programmers just want to implement it because they want to learn it?. But any new technology becomes useful if it is useful to the user. And Ajax is one of the technologies which will be useful as it really
5
1640
by: WaluigiCubed | last post by:
Hello everyone: I've been working on making some changes to the website for the company that I am currently an intern for. There is a function that they have in one of their files that uses CDOSYS to allow visitors to our site to email us with a support request. I've been testing this functionality out, but the emails aren't actually being sent to our email addresses. I've looked all over the internet for how to send an email using ASP,...
2
3057
by: =?Utf-8?B?R3JlZ0lJ?= | last post by:
Hi All, I have some problems with sending UDP packets using Winsock. I tried to send some to a closed port, and according to the documentation on Microsoft MSDN site (http://msdn.microsoft.com/en-us/library/ms740148(VS.85).aspx) subsequent calls of sendto function should result in returning WSAECONNRESET error code caused by returning ICMP destination unreachable message. My problem is that I do not see such effect, the sendto always...
0
9954
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10869
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9591
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7985
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5808
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6009
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3242
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.