Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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.IO;
using System.Net;

public partial class _Default : System.Web.UI.Page 
{
    
      
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        SendMsg();
        
       

    }
     public void SendMsg()
        {
         Label1.Text = "domain name";
            string uid= " 72656368617267656e657374 ";
            string pin = " 52c29795bc54d";
            string sender = "Your Sender ID";
	    string route = "1";
        string message = "scussfully recharge ";
            string mobile = TextBox1.Text;
            string amount = TextBox2.Text;
	    string domain = Label1.Text;
        string url = "http://" + domain + "/api/sms.php?uid=" + uid + "&pin=" + pin + "&sender=" + sender + "&route=" + route + "&mobile=" + mobile + "&amount=" + amount + "&message=" + message;


            HttpWebRequest httpreq = (HttpWebRequest)WebRequest.Create(url);
            try
            {
                HttpWebResponse httpres = (HttpWebResponse)httpreq.GetResponse();
                StreamReader sr = new StreamReader(httpres.GetResponseStream());
                string results = sr.ReadToEnd();
                sr.Close();
            }
            catch (Exception ex)
            {
                
            }
        }
   
}
Posted
Updated 14-Jan-14 5:21am
v4
Comments
Richard MacCutchan 14-Jan-14 11:23am    
You need to provide more information than "is not working properly" if you want assistance with this.

1 solution

No, because you did not describe what exactly is going wrong. If there is an error message/exception, we should be aware of it. If this is the behavior that is incorrect, then we need to know:
a) what is the behavior you are expecting
b) how actual behavior differs from what you are expecting

Having a quick look at your code, I would say that the domain variable is never initialized to a valid value (you initialize it with the content of a label, which obviously is not a valid domain name).

I suggest you put a beakpoint in the beginning of the Send() method, run your code in debug mode, and check the content of your variables to see which one does not have the value it should.

Good luck.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900