C# windows application needs to send a string as a parameter to a webpage

I have a C# windows app that needs to do something like what I have in Javascript here:

$data_string = escape($data_string);            
submitdatawindow = window.open("http://www.somewebpage/submithere.php?data_string=" + $data_string);

Basically I need to send a string like an HTML POST (with the escape function) to a web page.

Even better if someone can show me how to POST to a webpage from a C# windows application without actually having to open an IE browser.

Thanks, all
Who is Participating?
RichardRigaAuthor Commented:
I was looking this up on the web and had a thought... can I open an instance of IE using System.Diagnostics.Process.Start then, when I am finished with it, System.Diagnostics.Process.Kill it?
anyoneisConnect With a Mentor Commented:
Here is a windows forms app that does this:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;    

namespace SendToWebSite
    public partial class Form1 : Form
        public Form1()

        public DataSet m_DataSet = new DataSet();

        private void button1_Click(object sender, EventArgs e)
            StringBuilder rText = new StringBuilder();

            rText.Append(baseUrlTextBox.Text + '?');
            foreach (DataRow dr in m_DataSet.Tables[0].Rows)
                rText.Append(System.Web.HttpUtility.UrlEncode(dr["Param"].ToString()) + '=');
                rText.Append(System.Web.HttpUtility.UrlEncode(dr["Value"].ToString()) + '&');
            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(rText.ToString());
            HttpWebResponse resp = (HttpWebResponse)request.GetResponse();
            StreamReader respReader = new StreamReader(resp.GetResponseStream());
            responseTextBox.Text = respReader.ReadToEnd();

        private void Form1_Load(object sender, EventArgs e)
            DataTable dt = new DataTable();
            dt.Columns.Add("Param", typeof(string));
            dt.Columns.Add("Value", typeof(string));

            dt.Rows.Add("id", "343");

            parametersDataGridView.DataSource = m_DataSet;
            parametersDataGridView.DataMember = dt.TableName;
All Courses

From novice to tech pro — start learning today.