Thread: How to send data ( fields ) to an URL?

  1. #1
    Registered User AloneInTheDark's Avatar
    Join Date
    Feb 2008

    How to send data ( fields ) to an URL?

    How do I send some data to an URL? I seen some examples of "HttpWebRequest" but they all send only one string of "data" to the URL.

    I need to send a couple of fields, like a big text field ( textarea like ) and other fields with names and values.

    any idéas?

    Edit : Solved, sort'a

    Found this on some site :

    private void OnPostInfoClick(object sender, System.EventArgs e)
    string strId = UserId_TextBox.Text;
    string strName = Name_TextBox.Text;
    ASCIIEncoding encoding=new ASCIIEncoding();
    string postData="userid="+strId;
    postData += ("&username="+strName);
    byte[] data = encoding.GetBytes(postData);
    // Prepare web request...
    HttpWebRequest myRequest =
    myRequest.Method = "POST";
    myRequest.ContentLength = data.Length;
    Stream newStream=myRequest.GetRequestStream();
    // Send the data.
    Have not tested it but I'm gonna use XML instead so my problem is solved now.
    Last edited by AloneInTheDark; 02-12-2008 at 09:21 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. maximum data (bytes) send via socket ???
    By tritong in forum C Programming
    Replies: 6
    Last Post: 09-19-2006, 05:38 AM
  2. [question]Analyzing data in a two-dimensional array
    By burbose in forum C Programming
    Replies: 2
    Last Post: 06-13-2005, 07:31 AM
  3. Program Crashing
    By Pressure in forum C Programming
    Replies: 3
    Last Post: 04-18-2005, 10:28 PM
  4. can't insert data into my B-Tree class structure
    By daluu in forum C++ Programming
    Replies: 0
    Last Post: 12-05-2002, 06:03 PM