本文介绍了我可以在asp.net 2.0中发送短信吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想向很多人发送短信.
我正在使用使用Web服务的Code Project示例代码,但出现程序错误.
你能帮忙吗?
代码如下:
I want to send sms to lots of people.
I''m using a Code Project sample code which uses a web service, but I''m getting a program error.
Can you help?
Here''s the code:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace SmsTest
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
txtCountryCode.Enabled = false;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
protected void Send_Click(object sender, System.EventArgs e)
{
try
{
SmsTest.net.webservicex.www.SendSMS smsIndia = new SmsTest.net.webservicex.www.SendSMS();
SmsTest.com.webservicex.www.SendSMSWorld smsWorld = new SmsTest.com.webservicex.www.SendSMSWorld();
if (rdoType.SelectedValue == "1")
smsIndia.SendSMSToIndia(txtMobileNo.Text.Trim(), txtEmailId.Text.Trim(), txtMessage.Text);
else
smsWorld.sendSMS(txtEmailId.Text.Trim(), txtCountryCode.Text.Trim(), txtMobileNo.Text.Trim(), txtMessage.Text);
lblMessage.Visible = true;
lblMessage.Text = "Message Send Succesfully";
}
catch(Exception ex)
{
lblMessage.Visible = true;
lblMessage.Text="Error in Sending message"+ex.ToString();
}
}
protected void rdoType_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(rdoType.SelectedValue =="1")
txtCountryCode.Enabled = false;
else
txtCountryCode.Enabled = false;
}
}
}
推荐答案
这篇关于我可以在asp.net 2.0中发送短信吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!