如何使用c#发送短信 [英] how to send SMS using c#

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

问题描述

你好朋友,


$ b $我试图从我的网络应用程序发送短信,但在单线短信收到错误



远程服务器返回错误:(403)禁止。





,请建议我..



提前感谢







< pre lang =c#> 使用系统;
使用 System.Collections.Generic;
使用 System.Linq;
使用 System.Web;
使用 System.Web.UI;
使用 System.Web.UI.WebControls;
使用 System.Text;
使用 System.Net;
使用 System.IO;
使用 ASPSnippets.SmsAPI;


public partial class CS:System.Web.UI.Page
{
protected void btnSend_Click( object sender,EventArgs e)
{
SMS.APIType = SMSGateway.Site2SMS;
SMS.MashapeKey = < Mashape API Key>;
SMS.Username = txtNumber.Text.Trim();
SMS.Password = txtPassword.Text.Trim();
if (txtRecipientNumber.Text.Trim()。IndexOf( )== -1)
{
// 单个短信
SMS.SendSms(txtRecipientNumber.Text.Trim(),txtMessage.Text.Trim());
}
其他
{
// < span class =code-comment>多条短信
列表< string> numbers = txtRecipientNumber.Text.Trim()。Split(' ,')。ToList();
SMS.SendSms(numbers,txtMessage.Text.Trim());
}
}
}

解决方案

错误403表示服务器拒绝提供服务请求。您的帐户可能已被屏蔽,但您需要联系服务器管理员以了解是否属于这种情况。



提问有关问题的最佳地点文章在文章的评论部分。编写代码的人是最有可能帮助您的人!


hello friends ,

i am trying to do Send SMS from my web application, but getting error at single line sms

The remote server returned an error: (403) Forbidden.


, please suggest me ..

thanks in advance



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Net;
using System.IO;
using ASPSnippets.SmsAPI;


public partial class CS : System.Web.UI.Page
{
    protected void btnSend_Click(object sender, EventArgs e)
    {
        SMS.APIType = SMSGateway.Site2SMS;
        SMS.MashapeKey = "<Mashape API Key>";
        SMS.Username = txtNumber.Text.Trim();
        SMS.Password = txtPassword.Text.Trim();
        if (txtRecipientNumber.Text.Trim().IndexOf(",") == -1)
        {
            //Single SMS
            SMS.SendSms(txtRecipientNumber.Text.Trim(), txtMessage.Text.Trim());
        }
        else
        {
            //Multiple SMS
            List<string> numbers = txtRecipientNumber.Text.Trim().Split(',').ToList();
            SMS.SendSms(numbers, txtMessage.Text.Trim());
        }
    }
}

解决方案

Error 403 means that the server is refusing to serve the request. It's possible that your account has been blocked, but you would need to contact the server admins to find out if that's the case.

The best place to ask questions about an article is in the comments section for the article. The person who wrote the code is the person most likely to be able to help you with it!


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

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