Before going to intigrate sms gateway to our asp.net website we need to purchese sms gateway from venders.
Now a days there several providers for sms gateway.so based on your requirement you can go head.
Now hear we have a two type of sms are there they are Promotional and Transactional.
Both are same intigration pattaern.
Once you puchesed the api from vender u can use beloow code for intigrate sms gateway for our asp.net website.
- public class message {
- public string Conifrmation {
- set;
- get;
- }
- }
- public message SendMessage(string mobileNumber, string msg) {
- message msge = new message();
- try {
- string number = 123456789;
- string msges = "abcdefghijklmnopqrlstuvwxyz";
-
- string password = "abcd";
- string SenderID = "abcd";
-
-
-
- string strUrl = "http://domine.co.in/pushsms.php?username=useranme &password=" + password + "&sender=" + SenderID + "&message=" + msges + "&numbers=" + number;
- WebRequest request = HttpWebRequest.Create(strUrl);
- HttpWebResponse response = (HttpWebResponse) request.GetResponse();
- Stream s = (Stream) response.GetResponseStream();
- StreamReader readStream = new StreamReader(s);
- string dataString = readStream.ReadToEnd();
- response.Close();
- s.Close();
- readStream.Close();
- msge.Conifrmation = "Message Delivered To " + mobileNumber;
- } catch (Exception ex) {
- msge.Conifrmation = "Message Not Delivered To " + mobileNumber;
- }
- return msge;
- }