I have used below code for send sms.
in aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="sms.aspx.cs" Inherits="sms.sms" %>
onclick="Button1_Click" />
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net;
namespace sms
{
public partial class sms : System.Web.UI.Page
{
string uid;
string password;
string message;
string no;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
uid = "9836599564";
password = "8119fc";
message = TextBox2.Text;
no = TextBox1.Text;
send();
TextBox2.Text = "";
TextBox1.Text = "";
}
catch (Exception ex)
{
ex.Message.ToString();
}
}
//This is the code of API for sending message.
public void send()
{
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://ubaid.tk/sms/sms.aspx?uid=" + uid + "&pwd=" + password + "&msg=" + message + "&phone=" + no + "&provider=fullonsms");
HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
string responseString = respStreamReader.ReadToEnd();
respStreamReader.Close();
myResp.Close();
}
}
}
But after running the above code it shows an error, error is
The remote server returned an error: (403) Forbidden.
As far I know, this error shows, if an unauthenticated user tries to enter into the webservice. But I have create a account in fullonsms.com and just put the details in the uid and pwd. I don't know, what is reason behind this error. So please anyone can help me.
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
jeet guptaPosted Feb 23, 2015, 6:57 AM