如何从asp.net发送短信 [英] how to send sms from asp.net

查看:61
本文介绍了如何从asp.net发送短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从我的asp.net开发手机短信到www.clickatell.com,并获得url和api_id.
请检查以下代码,即使我没有收到错误和消息,也似乎无法正常工作.

导入System.Data
导入MySql.Data.MySqlClient
导入System.String
导入System.Net
导入System.IO
导入System.IO.StreamReader


受保护的子Button1_Click(ByVal发送者作为对象,ByVal e作为System.EventArgs)处理Button1.Click
用户名= TextBox1.Text.ToString()
密码= TextBox2.Text.ToString()
apiid = TextBox3.Text.ToString()
smsto = TextBox4.Text.ToString()
文字= TextBox5.Text.ToString()
昏暗的客户端作为WebClient =新的WebClient
client.Headers.Add("venu","Mozilla/4.0(兼容; MSIE 6.0; Windows NT 5.2; .NET CLR1.0.3705;)")
client.QueryString.Add("user",用户名)
client.QueryString.Add("password",密码)
client.QueryString.Add("api_id",apiid)
client.QueryString.Add(to,smsto)
client.QueryString.Add("text",text)
Dim baseurl As String ="http://api.clickatell.com/http/sendmsg"
昏暗的数据作为Stream = client.OpenRead(baseurl)
昏暗的阅读器,如StreamReader =新的StreamReader(data)
Dim s As String = reader.ReadToEnd()
data.Close()
reader.Close()
返回


结束子
结束类

i need to develop sms to mobiles from my asp.net i have regiistered in www.clickatell.com and i got url and api_id.
plz check the following code,it seems its not working even i am not getting error and message also.

Imports System.Data
Imports MySql.Data.MySqlClient
Imports System.String
Imports System.Net
Imports System.IO
Imports System.IO.StreamReader


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
username = TextBox1.Text.ToString()
password = TextBox2.Text.ToString()
apiid = TextBox3.Text.ToString()
smsto = TextBox4.Text.ToString()
text = TextBox5.Text.ToString()
Dim client As WebClient = New WebClient
client.Headers.Add("venu", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR1.0.3705;)")
client.QueryString.Add("user", username)
client.QueryString.Add("password", password)
client.QueryString.Add("api_id", apiid)
client.QueryString.Add(to", smsto)
client.QueryString.Add("text", text)
Dim baseurl As String = "http://api.clickatell.com/http/sendmsg"
Dim data As Stream = client.OpenRead(baseurl)
Dim reader As StreamReader = New StreamReader(data)
Dim s As String = reader.ReadToEnd()
data.Close()
reader.Close()
Return


End Sub
End Class

推荐答案

好吧,我做了通过Web服务使用.NET发送SMS [使用ASP.NET脚本发送SMS短信 [使用vb.net发送短信 [如何使用C#通过asp.net发送短信? [^ ]

Nutshell::ASP.NET不具有任何内置的API支持来发送SMS.您需要使用第三方解决方案或使用Internet上的某些内容.上面的文章和讨论将为您提供帮助.
Well, I did this[^], and got links like these and many more:
Articles:
Sending SMS using .NET through Web service[^]
Sending SMS text messages using ASP.NET scripts[^]

Discussion links:
sending sms using vb.net[^]
how to send sms through asp.net with c#? [^]

Nutshell: ASP.NET does NOT have any inbuilt API support to send out an SMS. You need to go for a third party solution or use something that is found on the Internet. Articles and discussions above should help you out.


这篇关于如何从asp.net发送短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆