Tuesday 3 January 2012

send sms by c sharp coding

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
//using System.Web.UI.WebControls;
//using System.Web.UI.WebControls.WebParts;
//using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Net.Mail;
using System.Net;
using System.IO;



namespace sms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string sURL = "http://smslane.com/vendorsms/pushsms.aspx?user=Deepak_Maurya&password=deepak1984&msisdn=" + txtphon.Text.ToString() + "&sid=Maurya&msg=" + txtmsg.Text.ToString() + "&mt=0&fl=0";
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(sURL);
            request.MaximumAutomaticRedirections = 4;
            request.Credentials = CredentialCache.DefaultCredentials;

           //int ss = 0;
            try
            {
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                Stream receiveStream = response.GetResponseStream();

                StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
                string sResponse = readStream.ReadToEnd();
                response.Close();
                label4.Visible = true;
                txtphon.Clear();
                txtmsg.Clear();

            }
            catch (Exception Ex)
            {
                Ex.ToString();
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            label4.Visible = false;
            txtphon.Focus();

        }

        private void txtphon_KeyPress(object sender, KeyPressEventArgs e)
        {
            label4.Visible = false;
        }
    }
}
  

Happy Programing..............
Any more information please contact
Mahesh arya
mhshry@yahoo.co.in
09045690193

1 comment: