Click here to Skip to main content
15,898,818 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am going make asp.net project & I want to send Sms from my page. There is no error when it runs but sms not send. please help for that



XML
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="SMS.aspx.vb" Inherits="Popup.SMS" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <br />
        <br />
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        <br />
        <br />
        <asp:Button ID="Button1" runat="server" Text="Button" />

    </div>
    </form>
</body>
</html>



VB
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.IO.Ports


Public Class SMS
    Inherits System.Web.UI.Page
    Dim sp As New SerialPort()
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        sp.PortName = "COM3"
        sp.Open()
        Dim ph_no As String = [Char].ConvertFromUtf32(34) & TextBox1.Text & [Char].ConvertFromUtf32(34)
        sp.Write("AT+CMGF=1" & [Char].ConvertFromUtf32(13))
        sp.Write("AT+CMGF=" & ph_no & [Char].ConvertFromUtf32(13))
        sp.Write(TextBox2.Text & [Char].ConvertFromUtf32(26) & [Char].ConvertFromUtf32(13))
        sp.Close()
    End Sub
End Class
Posted
Updated 28-Oct-13 23:30pm
v2
Comments
Richard MacCutchan 29-Oct-13 5:32am    
You need to send SMS via a service provider as far as I am aware.
ZurdoDev 29-Oct-13 7:33am    
Since when do you send SMS over the serial port?

1 solution

Just look over this video.
here is very good explanation...

http://www.youtube.com/watch?v=wtT1EvJT4kU[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900