/* ------------------------ My Meta Content Here SEO ------------------------ */

Pages

Main Menu

Friday, August 31, 2012

C Sharp dot net Send Bulk SMS (Sending sms to mutiple recipient.)

Handling Web Request in c sharp dot net

Code Here:

///
/// Method used to send bulk sms
///

///

public void SendMsg(string URL)
{
try
{
// Create a request using a URL that can receive a post.
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(URL);

webRequest.Method = WebRequestMethods.Http.Get;

webRequest.AllowAutoRedirect = true;

webRequest.PreAuthenticate = true;

webRequest.AuthenticationLevel = System.Net.Security.AuthenticationLevel.None;

webRequest.KeepAlive = false; // Set Keep alive to false (not to make persistent connection with server)

webRequest.ContentType = "application/x-www-form-urlencoded";

HttpWebResponse res = (HttpWebResponse)(webRequest.GetResponse());

System.IO.StreamReader sr = new System.IO.StreamReader(res.GetResponseStream(), Encoding.GetEncoding("UTF-8"));

StringBuilder responseText = new StringBuilder(String.Empty);

responseText.Append(sr.ReadToEnd());

webRequest = null;
}
catch (Exception _ex)
{}
}
________________________________________________________________________________

///
/// Method for sending sms to all user that belong to the hierarchy selected from the hierarchy chain
///
    private void SendSMS()
    {
        //Do not change
        string FeedID = "287089";
        //Your number
        string sendTo = "";
        //Do not change
        string Uname = "9833664117";
        //Do not change
        string Pwd = "awajw";

        string Query = "";

        string msg = "";

        dsRecord = ObjComFunc.GetAnnouncement(Convert.ToInt32(Request.QueryString["id"].ToString()), "SI");
        if (dsRecord != null)
        {
            if (dsRecord.Tables[0].Rows.Count > 0)
            {
                msg = Convert.ToString(dsRecord.Tables[0].Rows[0]["S_Brief_Desc"].ToString());
            }
        }
        else
        {
            msg = "";
        }
        
        //string msg = "We have received your request for verification code. Your code is 1234. If you have not requested code, kindly ignore this message.";

        //Gett All Center Numbers
        DataTable dtSendTo = GetCentersPhoneNumbers();

        if (dtSendTo != null)
        {
            if (dtSendTo.Rows.Count > 0)
            {
                for (int i = 0; i < dtSendTo.Rows.Count; i++)
                {
                    sendTo = dtSendTo.Rows[i][0].ToString().Trim();
                    Query = "http://bulkpush.mytoday.com/BulkSms/SingleMsgApi?feedid=" + FeedID + "&To=" + sendTo + "&UserName=" + Uname + "&Password=" + Pwd + "&Text=" + msg;
                    ObjComFunc.SendMsg(Query);
                    //Response.Redirect(Query);
                }
            }
        }
    }
________________________________________________________________________________

2 comments:

  1. Thanks we always provide bulk SMS online services and web sms online... please visit at-

    send bulk sms online

    ReplyDelete

My Blog List

  • काश - काश मुझे भी पीने की आदत होती,मैं कब का मुर्दा हो गया होता। छुटकारा मिलता आज के आतंकवाद से, किसी संतान भूमि में सो गया होता। मेरा एतबार कौन करेगा, मैंने मुर...
    3 months ago
  • काश - काश मुझे भी पीने की आदत होती,मैं कब का मुर्दा हो गया होता। छुटकारा मिलता आज के आतंकवाद से, किसी शमशान भूमि में सो गया होता। मेरा एतबार कौन करेगा, मैंने मुर...
    3 months ago
  • Kumaon University Nainital B.Ed entrance exam test result 2012 - कुमाऊँ विश्वविधालय, नैनीताल (उत्तराखण्ड)
    10 years ago