Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to pass the textbox value as parameter in url

how to pass the textbox value as parameter in url

Scheduled Pinned Locked Moved C#
hostingjsonhelptutorialquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sudhir behera
    wrote on last edited by
    #1

    hello sir, i got an api for sending sms.i am implemneting it in my software.the hosting company has sent me the url and some codes.when pasting the url in my browser followed by my mobile no and message.then i am able to get the sms.but i have designed a windows form which contains 2 textboxes such as for mobile no and message respectively.and a send button.i want the mobile no and message from textboxes will pass as parameters in the url.how will i pass this value?please help my,its urgent. i am posting details of my code: ---------------------------------- private static string CALLURL(string url) { string Res = ""; try { HttpWebRequest gatewayReq; //Used for HTTP Request HttpWebResponse gatewayRes; //Used for HTTP Response gatewayReq = (HttpWebRequest)WebRequest.Create(url); gatewayReq.Timeout = 60000; gatewayReq.Method = "GET"; gatewayRes = (HttpWebResponse)gatewayReq.GetResponse(); Stream ReceiveStream = gatewayRes.GetResponseStream(); StreamReader sr = new StreamReader(ReceiveStream);//, System.Text.Encoding.ASCII); Res = sr.ReadToEnd(); MessageBox.Show("message sent successfully."); } catch { //Res = "URL is not responding at the moment."; //WriteErrorLog(DateTime.Now + "|" + "Call URL Function: " + ex.Message.ToString()); MessageBox.Show("Sorry,Unable to send Sms.Try Again Later."); } return Res; } private void send_Click(object sender, EventArgs e) { string url; string msg; Int64 no; no = Convert.ToInt64(textBox1.Text); msg = textBox2.Text; url = "http://203.212.64.15/genericpushnew/pushsms.aspx?userid=demo123&password=hotmail01&masking=CVRTNP&mobileno=no&message=msg"; CALLURL(url); } }

    L G N 3 Replies Last reply
    0
    • S sudhir behera

      hello sir, i got an api for sending sms.i am implemneting it in my software.the hosting company has sent me the url and some codes.when pasting the url in my browser followed by my mobile no and message.then i am able to get the sms.but i have designed a windows form which contains 2 textboxes such as for mobile no and message respectively.and a send button.i want the mobile no and message from textboxes will pass as parameters in the url.how will i pass this value?please help my,its urgent. i am posting details of my code: ---------------------------------- private static string CALLURL(string url) { string Res = ""; try { HttpWebRequest gatewayReq; //Used for HTTP Request HttpWebResponse gatewayRes; //Used for HTTP Response gatewayReq = (HttpWebRequest)WebRequest.Create(url); gatewayReq.Timeout = 60000; gatewayReq.Method = "GET"; gatewayRes = (HttpWebResponse)gatewayReq.GetResponse(); Stream ReceiveStream = gatewayRes.GetResponseStream(); StreamReader sr = new StreamReader(ReceiveStream);//, System.Text.Encoding.ASCII); Res = sr.ReadToEnd(); MessageBox.Show("message sent successfully."); } catch { //Res = "URL is not responding at the moment."; //WriteErrorLog(DateTime.Now + "|" + "Call URL Function: " + ex.Message.ToString()); MessageBox.Show("Sorry,Unable to send Sms.Try Again Later."); } return Res; } private void send_Click(object sender, EventArgs e) { string url; string msg; Int64 no; no = Convert.ToInt64(textBox1.Text); msg = textBox2.Text; url = "http://203.212.64.15/genericpushnew/pushsms.aspx?userid=demo123&password=hotmail01&masking=CVRTNP&mobileno=no&message=msg"; CALLURL(url); } }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      url = "http://203.212.64.15/...... change it to : StringBuilder sb = new StringBuilder(); sb.Append("http://203.212.64.15/genericpushnew/pushsms.aspx?userid=demo123&password=hotmail01&masking=CVRTNP&mobileno="); sb.Append(textBoxNumber.Text); sb.Append(&message=); sb.Append(textBoxMessage.Text); url = sb.ToString();

      1 Reply Last reply
      0
      • S sudhir behera

        hello sir, i got an api for sending sms.i am implemneting it in my software.the hosting company has sent me the url and some codes.when pasting the url in my browser followed by my mobile no and message.then i am able to get the sms.but i have designed a windows form which contains 2 textboxes such as for mobile no and message respectively.and a send button.i want the mobile no and message from textboxes will pass as parameters in the url.how will i pass this value?please help my,its urgent. i am posting details of my code: ---------------------------------- private static string CALLURL(string url) { string Res = ""; try { HttpWebRequest gatewayReq; //Used for HTTP Request HttpWebResponse gatewayRes; //Used for HTTP Response gatewayReq = (HttpWebRequest)WebRequest.Create(url); gatewayReq.Timeout = 60000; gatewayReq.Method = "GET"; gatewayRes = (HttpWebResponse)gatewayReq.GetResponse(); Stream ReceiveStream = gatewayRes.GetResponseStream(); StreamReader sr = new StreamReader(ReceiveStream);//, System.Text.Encoding.ASCII); Res = sr.ReadToEnd(); MessageBox.Show("message sent successfully."); } catch { //Res = "URL is not responding at the moment."; //WriteErrorLog(DateTime.Now + "|" + "Call URL Function: " + ex.Message.ToString()); MessageBox.Show("Sorry,Unable to send Sms.Try Again Later."); } return Res; } private void send_Click(object sender, EventArgs e) { string url; string msg; Int64 no; no = Convert.ToInt64(textBox1.Text); msg = textBox2.Text; url = "http://203.212.64.15/genericpushnew/pushsms.aspx?userid=demo123&password=hotmail01&masking=CVRTNP&mobileno=no&message=msg"; CALLURL(url); } }

        G Offline
        G Offline
        Ghydo
        wrote on last edited by
        #3

        Use this:

        url = string.Format("http://203.212.64.15/genericpushnew/pushsms.aspx?userid=demo123&password=hotmail01&masking=CVRTNP&mobileno={0}&message={1}",
        Convert.ToInt64(textBox1.Text), textBox2.Text);

        1 Reply Last reply
        0
        • S sudhir behera

          hello sir, i got an api for sending sms.i am implemneting it in my software.the hosting company has sent me the url and some codes.when pasting the url in my browser followed by my mobile no and message.then i am able to get the sms.but i have designed a windows form which contains 2 textboxes such as for mobile no and message respectively.and a send button.i want the mobile no and message from textboxes will pass as parameters in the url.how will i pass this value?please help my,its urgent. i am posting details of my code: ---------------------------------- private static string CALLURL(string url) { string Res = ""; try { HttpWebRequest gatewayReq; //Used for HTTP Request HttpWebResponse gatewayRes; //Used for HTTP Response gatewayReq = (HttpWebRequest)WebRequest.Create(url); gatewayReq.Timeout = 60000; gatewayReq.Method = "GET"; gatewayRes = (HttpWebResponse)gatewayReq.GetResponse(); Stream ReceiveStream = gatewayRes.GetResponseStream(); StreamReader sr = new StreamReader(ReceiveStream);//, System.Text.Encoding.ASCII); Res = sr.ReadToEnd(); MessageBox.Show("message sent successfully."); } catch { //Res = "URL is not responding at the moment."; //WriteErrorLog(DateTime.Now + "|" + "Call URL Function: " + ex.Message.ToString()); MessageBox.Show("Sorry,Unable to send Sms.Try Again Later."); } return Res; } private void send_Click(object sender, EventArgs e) { string url; string msg; Int64 no; no = Convert.ToInt64(textBox1.Text); msg = textBox2.Text; url = "http://203.212.64.15/genericpushnew/pushsms.aspx?userid=demo123&password=hotmail01&masking=CVRTNP&mobileno=no&message=msg"; CALLURL(url); } }

          N Offline
          N Offline
          niranjankarekar
          wrote on last edited by
          #4

          well its quite easy but ur calling the functions in a wrong way.... We did the same project in VB,C# as well as asp.net successfully. 9870187165

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups