从ASP.NET网站发送短信 [英] Sending SMS from an ASP.NET website

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

问题描述

是否可以使用Web API从ASP.NET网站发送SMS?我了解网络服务,但不知道如何从我的应用中调用这些服务.

Is there a way to send SMS from an ASP.NET website using a Web API? I know about web services, but don't know how to call those services from my app.

推荐答案

Web服务是最好的方法.我在网站上使用Twilio,并且设置和工作非常容易.可伸缩性不是问题,而且您将不必花费开发人员时间来构建自己的解决方案,就可以弥补成本.

Web services are the best way to do it. I use Twilio on a site, and it was incredibly easy to get set up and working. Scalability is no issue, and you will more than make up for the cost in not having to spend developer hours building your own solution.

Twilio: http://www.twilio.com/

可用于.NET的Twilio库: https://www.twilio.com/docs/csharp/install

Twilio libraries available for .NET: https://www.twilio.com/docs/csharp/install

在twilio-csharp项目中,这是如何发送SMS的示例(我从twilio-csharp中获取了此消息.只需重新发布以显示它是多么容易)

From the twilio-csharp project, here is the example of how to send an SMS (I took this from twilio-csharp. Just reposting it to show how easy it is)

static void Main(string[] args)
{
    TwilioRestClient client;

    // ACCOUNT_SID and ACCOUNT_TOKEN are from your Twilio account
    client = new TwilioRestClient(ACCOUNT_SID, ACCOUNT_TOKEN);

    var result = client.SendMessage(CALLER_ID, "PHONE NUMBER TO SEND TO", "The answer is 42");
    if (result.RestException != null) {
        Debug.Writeline(result.RestException.Message);
    }    
}

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

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