C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to send sms through asp.net web application


Posted Date: 19 Jul 2008      Total Responses: 1

Posted By: anand       Member Level: Bronze     Points: 1


Anybody can help me plz..
i have some option in my application like sending sms to clients through
asp.net in click event??

Thanks in Advance




Responses

Author: Kumar Velu    19 Jul 2008Member Level: DiamondRating:     Points: 3
hi,

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Xml;
using System.IO;
using System.Net;
using System.Runtime.InteropServices;
using System.Reflection;

namespace sortMessage
{
public class smsClass
{

string tmp;
String result = "";
DataSet ds;
string url,pwd,uid;
string path = @"C:\Smsc\smsc.xml";
public string sendMessage(string mobileNumber, string smallMessage)
{
try
{
ds = new DataSet();
ds.ReadXml(path);

uid = ds.Tables[0].Rows[0][0].ToString();
pwd = ds.Tables[0].Rows[0][1].ToString();
url = ds.Tables[0].Rows[0][2].ToString();

String strPost = string.Format("user={0}&pwd={1}&mno={2}&msg={3}&target={4}", uid, pwd, mobileNumber, smallMessage,url);// "http://info.centrissoftware.com:8080/smsc/SendSMS");
StreamWriter myWriter = null;

HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);//"http://info.centrissoftware.com:8080/smsc/SendSMS");
objRequest.Method = "POST";
objRequest.ContentLength = strPost.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";

myWriter = new StreamWriter(objRequest.GetRequestStream());
myWriter.Write(strPost);

myWriter.Close();

HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
using (StreamReader sr =
new StreamReader(objResponse.GetResponseStream()))
{
result += sr.ReadToEnd();

// Close and clean up the StreamReader
sr.Close();
}


}
catch (Exception ex)
{
result = ex.Message;
}

return result;
}

}
}




Post Reply
You must Sign In to post a response.
Next : I need to deploy the web application with crystal report but i cant see the report..
Previous : Communication between the php and asp.net web application
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use